You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a look on the API proposed in the branch develop (See man ./docopts.1). Which is quite different from the current docopts API.
Old API (current)
eval"$(python3 $libexec/docopts -A args -V "$version" -h "$help":"$@")"if${args[--do-something]};then
run_some_code
fi
current API in branch develop, generating temporary files for each option on the filesystem
tmpdir=$(echo "$help"| python3 $libexec/docopts "$@")if [ -e$tmpdir/--do-something ];thenecho"Option given with argument $(cat $tmpdir/--do-something)."fi
I think about a new API, more like the python's library could be quite nice to have.
Something like the following code snippet, (to be completed…)
Specifying the associative array for $args and some shell centric behavior have to be considered, too.
#!/bin/bash# sourcing the API providing some bash functions ie: docopt()# still using the python parsersource docopts.sh
parsed=$(docopt -A args "$help_string""$@""$version""$options_first")eval"$parsed"
Please comment and suggest. I will develop and propose some versions.
You may also be tempted to say: "bash is not capable to handle simply the complexity of the JSON parsed structure behind docopt. Consider rewriting your shell script directly in python…"