Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2015 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/825e4deab917cf4c1154 to your computer and use it in GitHub Desktop.
Save anonymous/825e4deab917cf4c1154 to your computer and use it in GitHub Desktop.
#!/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