]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Better usage handling
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 11 Jul 2013 19:44:20 +0000 (16:44 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 11 Jul 2013 19:44:20 +0000 (16:44 -0300)
keyringer
lib/keyringer/functions
share/keyringer/commands [new file with mode: 0755]
share/keyringer/usage [new file with mode: 0755]

index 0f6372c33ad1525c581dcc482f5640f64ded08cd..934f600473fc044d2314a99150077d1639b70715 100755 (executable)
--- a/keyringer
+++ b/keyringer
@@ -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
 
index 1d291573a30fcee365fc9764b642d122279252ae..3fa71706e5602b9df603f5964b65b0f40c40dff0 100644 (file)
@@ -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 (executable)
index 0000000..139725a
--- /dev/null
@@ -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 (executable)
index 0000000..54cbea6
--- /dev/null
@@ -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/'