diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-18 13:27:02 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-18 13:27:02 -0300 |
commit | accf65eda77b9a6c6edffcca825ddbc32e3cc63b (patch) | |
tree | 63fe0a881d27208a7f1f16ae2943036bac18ef1f /lib | |
parent | f9e575896519e78788b0bb5cd2eb1f1f4840f88a (diff) | |
download | keyringer-accf65eda77b9a6c6edffcca825ddbc32e3cc63b.tar.gz keyringer-accf65eda77b9a6c6edffcca825ddbc32e3cc63b.tar.bz2 |
Making code that checks for command argument as a common function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/keyringer/functions | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 96ca7e6..630f519 100644 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -192,16 +192,6 @@ function keyringer_set_env { fi } -# Get a single argument -function keyringer_get_arg { - if [ -z "$1" ]; then - keyringer_action_usage - exit 1 - fi - - echo $1 -} - # Get a file argument function keyringer_get_file { FILE="`keyringer_filename $1`" @@ -222,6 +212,21 @@ function keyringer_action_usage { keyringer_usage_$BASENAME else # Default usage - echo "Usage: keyringer <keyring> $BASENAME <file>" + if [ "$1" == "command" ]; then + echo "Usage: keyringer <keyring> $BASENAME <command> [arguments]" + else + echo "Usage: keyringer <keyring> $BASENAME <file>" + fi + fi +} + +# Get a command argument +function keyringer_get_command { + # Aditional parameters + COMMAND="$1" + + if [ -z "$COMMAND" ]; then + keyringer_action_usage command + exit 1 fi } |