1 #Write all help of syd tools in a file sydTool.md
2 #Execute it in src folder but the tools have to be into ../bin/bin (or change it)
3 #Results are in src folder
8 #Copy all help into a temporary file
11 clitkTools=`ls clitk*`
12 echo "This page contains additional information on how to use clitk tools:" > $tempFile
13 echo "<<TableOfContents()>>" >> $tempFile
15 for tool in $clitkTools
17 echo "==== " $tool " ====" >> $tempFile
26 docFile="$currentFolder/clitkTool.txt"
28 helpLine=false #Boolean to know if we are reading the command lines starting with '-h, --help' and finishing with '##' or just the help
31 while IFS='' read -r line || [[ -n "$line" ]]; do #read all lines
33 line=`echo "$line" | sed -e 's/^[ \t]*//'`; # prevent whitespace at the begining of the line
34 if [[ $line == *"-h, --help"* ]]; then
37 if [[ $line == *"===="* ]]; then
39 echo "$echoLine||" >> $docFile;
51 if [[ $line == "" ]]; then
54 #Create the string according to the different case of ggo
59 if [[ $line == "-"[a-zA-Z]* ]]; then
61 echoLine="$echoLine||";
62 echo "$echoLine" >> $docFile;
66 tempString=`echo "$line" | cut -c1-2`; # eg take the -h
67 echoLine="$echoLine$tempString";
68 line=`echo "$line" | cut -d' ' -f2-`; # remove -h, (first word)
69 line=`echo "$line" | sed -e 's/^[ \t]*//'`; # prevent whitespace at the begining of the line
70 echoLine="$echoLine||";
71 tempString=`echo "$line" | cut -f 1 -d " "`; # eg take the --help (first word)
72 echoLine="$echoLine$tempString";
73 line=`echo "$line" | cut -d' ' -f2-`; # remove --help (first word)
74 line=`echo "$line" | sed -e 's/^[ \t]*//'`; # prevent whitespace at the begining of the line
75 echoLine="$echoLine||$line";
76 elif [[ $line == "--"* ]]; then
78 echoLine="$echoLine||";
79 echo "$echoLine" >> $docFile;
83 tempString=`echo "$line" | cut -f 1 -d " "`; # eg take the --help (first word)
84 echoLine="$echoLine$tempString";
85 line=`echo "$line" | cut -d' ' -f2-`; # remove --help (first word)
86 line=`echo "$line" | sed -e 's/^[ \t]*//'`; # prevent whitespace at the begining of the line
87 echoLine="$echoLine||$line";
88 elif [[ $copyLine == " "* ]]; then
89 echoLine="$echoLine$line";
92 echoLine="$echoLine||";
93 echo "$echoLine" >> $docFile;
95 echoLine="||||||<style=\"" & quot;text-align:center& quot; "\">$line||";
96 echo "$echoLine" >> $docFile;
101 if [[ `echo "$line" | cut -c1-1` = "-" ]]; then
102 echo " " >> $docFile;
103 echo "\\$line" >> $docFile;
105 echo "$line" >> $docFile;
109 echo "$echoLine||" >> $docFile