optparse
optparse copied to clipboard
Simple command line arguments parser for BASH
Error occurs when a space is in argument default values (or passed from command line too, I believe). This is because the value assignment is not quoted at all in...
Optparse breaks when `set -o nounset` is enabled. This option makes bash generate an error when an uninitialized variable is encountered. Having this option on is generally good practice, kinda...
Here's an example: ``` $ ./a.sh -v -L wfrge Would get: scp -P22334 [email protected]:/opt/scripts/db/.backup To: /vagrant/db/.backup $ ./a.sh -v 1 -L wfrge SSH login is required option. For help invoke...
Modified optarse.bash to generate completion file Modified Readme.md for the use of bash completion New example script
- Add handling of "**--**" to split script arguments from not to parse arguments - Add **-h** as also possible help request - Mark args with **value=...** as flags -...
The **--** stopper is not recognized to stop parsing arguments Test: ``` #!/bin/bash . optparse.bash optparse.define short=t long=test desc='Test run' variable=TEST value=1 default=0 source $( optparse.build ) echo "$@" ```...
The arguments help is differerent aligned than the "default" help description. Test: ``` #!/bin/bash . optparse.bash optparse.define short=T long=test desc='Test run' variable=TEST default=false source $( optparse.build ) echo "$@" ```...
Code adapted a little to also generate Tab completion for a script. Added a new script which generate completion and parsing. Example modified to reflect the use of a list...
The optparse.bash code has a mix of tabs an spaces. Please stick to one. ;-)