diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-07-11 16:44:20 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-07-11 16:44:20 -0300 |
commit | 8da5023df4b4e3ec55bf52b4377920a8ece941e2 (patch) | |
tree | 95cf758e3366f9a2edc549bb8905e4c40c92693d | |
parent | 50e14d3d46f880519a6b258528c65ccd2caf02cc (diff) | |
download | keyringer-8da5023df4b4e3ec55bf52b4377920a8ece941e2.tar.gz keyringer-8da5023df4b4e3ec55bf52b4377920a8ece941e2.tar.bz2 |
Better usage handling
-rwxr-xr-x | keyringer | 4 | ||||
-rw-r--r-- | lib/keyringer/functions | 12 | ||||
-rwxr-xr-x | share/keyringer/commands | 10 | ||||
-rwxr-xr-x | share/keyringer/usage | 12 |
4 files changed, 35 insertions, 3 deletions
@@ -141,9 +141,7 @@ source "$LIB" || exit 1 keyringer_config_load if [ -z "$ACTION" ]; then - printf "Usage: %s <keyring> <action> [arguments]\n" "$BASENAME" - printf "Available commands: \n" - ls $ACTIONS | sed -e 's/^/\t/' + keyringer_usage exit 1 fi diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 1d29157..3fa7170 100644 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -342,6 +342,18 @@ function keyringer_action_usage { fi } +# Return available actions +function keyringer_show_actions { + ls $ACTIONS +} + +# Usage +function keyringer_usage { + printf "Usage: %s <keyring> <action> [arguments]\n" "$BASENAME" + printf "Available commands: \n" + keyringer_show_actions | sed -e 's/^/\t/' +} + # Check recipients function keyringer_check_recipients { if [ "$KEYRINGER_CHECK_RECIPIENTS" == "false" ]; then diff --git a/share/keyringer/commands b/share/keyringer/commands new file mode 100755 index 0000000..139725a --- /dev/null +++ b/share/keyringer/commands @@ -0,0 +1,10 @@ +#!/bin/bash +# +# Show available commands +# + +# Load functions +LIB="`dirname $0`/../../lib/keyringer/functions" +source "$LIB" || exit 1 + +keyringer_show_actions diff --git a/share/keyringer/usage b/share/keyringer/usage new file mode 100755 index 0000000..54cbea6 --- /dev/null +++ b/share/keyringer/usage @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Show available commands +# + +# Load functions +LIB="`dirname $0`/../../lib/keyringer/functions" +source "$LIB" || exit 1 + +printf "Usage: %s <keyring> <action> [arguments]\n" "$BASENAME" +printf "Available commands: \n" +ls $ACTIONS | sed -e 's/^/\t/' |