Merge pull request #1 from molovo/version-0.1.x

Release 0.1.1
This commit is contained in:
James Dinsdale 2016-09-02 22:45:11 +01:00
commit 3ebf236761
2 changed files with 68 additions and 1 deletions

View file

@ -1,5 +1,22 @@
#!/usr/bin/env zsh
###
# Output usage information and exit
###
function _revolver_usage() {
echo "\033[0;33mUsage:\033[0;m"
echo " revolver [options] <command> <message>"
echo
echo "\033[0;33mOptions:\033[0;m"
echo " -h, --help Output help text and exit"
echo " -v, --version Output version information and exit"
echo
echo "\033[0;33mCommands:\033[0;m"
echo " start <message> Start the spinner"
echo " update <message> Update the message"
echo " stop Stop the spinner"
}
###
# The main revolver process, which contains the loop
###
@ -155,7 +172,24 @@ function _revolver_start() {
###
function _revolver() {
# Get the context from the first parameter
local ctx="$1"
local help version ctx="$1"
# Parse CLI options
zparseopts -D \
h=help -help=help \
v=version -version=version
# Output usage information and exit
if [[ $help ]]; then
_revolver_usage
exit 0
fi
# Output version information and exit
if [[ $version ]]; then
echo '0.1.1'
exit 0
fi
case $ctx in
start|update|stop)

33
revolver.zsh-completion Normal file
View file

@ -0,0 +1,33 @@
#compdef revolver
_commands=(
'start:start the spinner process'
'update:update the message'
'stop:stop the spinner process'
)
###
# Complete revolver commands
###
function _revolver_commands() {
_describe -t commands 'commands' _commands "$@"
}
###
# Revolver completion
###
function _revolver() {
typeset -A opt_args
local context state line curcontext="$curcontext"
# Set option arguments
_arguments -A \
'(-h --help)'{-h,--help}'[show help text and exit]' \
'(-v --version)'{-v,--version}'[show version information and exit]'
# Set log level arguments
_arguments \
'1: :_revolver_commands'
}
_revolver "$@"