Created
September 14, 2015 15:33
-
-
Save anonymous/825e4deab917cf4c1154 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
main() { | |
eval "$(docopts -V - -h - : "$@" <<EOF | |
Usage: tool [options] | |
--page=<page> Page numbers [default: 10] | |
--user=<user> Username | |
--password=<pwd> Password | |
--verbose Generate verbose messages. | |
--help Show help options. | |
--version Print program version. | |
---- | |
tool 0.1.0 | |
Copyright (C) 2015 HortonWorks | |
EOF | |
)" | |
if $verbose ; then | |
echo "Verbose: true" | |
echo "args: ${args[*]}" | |
fi | |
if [[ "$user" ]]; then | |
echo "USER=$user" | |
fi | |
if [[ "${password}" ]] ; then | |
echo "PASSWORD=${password}" | |
fi | |
echo "page: $page" | |
} | |
if ! docotsx -h &> /dev/null ; then | |
echo "Please install docopts via: 'pip install docopts'" | |
exit 1 | |
fi | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment