User Tools

Site Tools


unixscripts:3-decentbash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
decentbash [2016/01/01 01:23] – [Error messages] adminunixscripts:3-decentbash [2020/10/17 03:04] – ↷ Page moved and renamed from decentbash to unixscripts:3-decentbash admin
Line 13: Line 13:
  
 ====Use argp.sh(1)==== ====Use argp.sh(1)====
-Even better, use my **getopt**(1) wrapper [[argp.sh]] which is kinda sorta like GNU's **argp**(3) in glibc. It gives you a single place to define options which is then used to:+Even better, use my **getopt**(1) wrapper [[unixscripts:2-argp.sh]] which is kinda sorta like GNU's **argp**(3) in glibc. It gives you a single place to define options which is then used to:
       * create the **getopt**(1) command line,        * create the **getopt**(1) command line, 
       * process the options setting appropriate environment parameters        * process the options setting appropriate environment parameters 
Line 26: Line 26:
  
 ====Provide help==== ====Provide help====
-respond to the **-h, --help** option with a usage message to **!!!STDOUT!!!** and exit 0+respond to the **-h, --help** option with a usage message to **!!!STDOUT!!!** and exit 0. This help should be available no matter what the machine's state - so issue it before looking for dependencies and without making assumptions about what is installed. 
 + 
 +If there are specific dependencies, then make sure they are documented in the help message.
  
 ====Provide version info==== ====Provide version info====
Line 36: Line 38:
 Error messages should go to **!!!STDERR!!!** - do **not** print the usage as it just fills the screen and hides the meat of the error. At the most, refer the user to the usage page with ''run 'foobar -h' for help or 'man foobar' for a reference manual.'' Error messages should go to **!!!STDERR!!!** - do **not** print the usage as it just fills the screen and hides the meat of the error. At the most, refer the user to the usage page with ''run 'foobar -h' for help or 'man foobar' for a reference manual.''
  
-====Error exit====+====Be disciplined with error exit codes====
 non-zero exit on any error non-zero exit on any error
  
Line 47: Line 49:
 include a man page if non-trivial include a man page if non-trivial
  
-====crunchbang====+====Use a crunchbang====
 always include the //crunchbang// as the first line: always include the //crunchbang// as the first line:
  
unixscripts/3-decentbash.txt · Last modified: 2020/10/17 03:04 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki