1
0
Fork 0
C_lib/docs/generate_docs.sh

36 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/zsh
# This script is used to build all the documentation.
# TODO: create options for generating different file types (pdf, html or utf8 to console/file).
# Prompt user at the start for what type they want.
# Get the initial root.
root_directory=$(pwd)
# Specify the file paths, in the order where they should be built.
filepaths=('nodes/single_node.h.ms')
# Loop over the paths: change directory, build, go back up to the root directory.
for i in $filepaths; do
# Get the current directory that we should change into, from the current array variable.
current_directory=$(dirname $i)
cd $current_directory
# Get the input and output file names.
input_file=$(basename $i)
output_file=$(echo $input_file | sed 's/ms/pdf/')
# Debug prints.
#echo "current_directory = $current_directory"
#echo "input_file = $input_file"
#echo "output_file = $output_file"
# Create the output file.
touch $output_file
# Generate docs.
groff -ms -Tpdf $input_file > $output_file
# Go back up to the root.
cd $root_directory
done