I'm writing a script that has the vocation to be a fully featured program at the end. As far as I know, BASH is enough for his purpose (manage PPA's, kinda like Y-PPA). I would like to know how to output the help
Currently, help is written with
echo -e directly inside the script and called with a
if [ "$1" == "--help" ] || [ "$1" == "-h" ] (I plan on switching that to getopts soon).
But what's better ? To leave the
help section inside the script or to just write a line to call another file containing the help ?
In my opinion, leaving it inside the script could be better because :
- My program will remain a one text-file script
- It saves space on the hard-drive
- It avoids having an error with displaying another file that could be corrupted or in a different location
But having a different text-file containing the help could also be better because :
- The main script called with
myscriptcommand would be lighter
- It simplifies the human-reading of the script
- It allows to update the help page separately if needed
- It could even allow to display only the help page with a GUI, and/or print it.
So you see, I don't know what's the "usual" way of doing this. Thank you !
PS : please also note that since I'm planning to release a complete program, a man-page would be great so I would anyway have to provide more than 1 file, maybe simply a .deb