docopt / docopts

Shell interpreter for docopt, the command-line interface description language.
Other
504 stars 53 forks source link

Enable use of 'set -u' #33

Closed rdonkin closed 5 years ago

rdonkin commented 5 years ago

set -u is useful to detect coding errors where variables are unset, and is part of unofficial strict mode for bash.

This does affect the use of $1 etc - this PR fixes errors in docopts.sh that occur when set -u is enabled. The code still works without set -u enabled, of course.

The examples commit is optional, no need to include when merging but it might be helpful to see that it works.

Tested under bash 5.0 and 3.2.

Sylvain303 commented 5 years ago

May you can drop a sort paragraph in README.md? About set -u and unofficial strict mode

Between, OPTIONS and EXAMPLES I guess.

Some other compatibles usages, may grow here.

rdonkin commented 5 years ago

I've done README.md update in new COMPATIBILITY section. I also included a paragraph on bash 4.x and bash 3.2 support, mentioning the new --auto -G feature.

Will do new PR for that commit so it's easy to merge.