]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Initial implementation for keyringer shell (#34)
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 10 Dec 2013 14:52:56 +0000 (12:52 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 10 Dec 2013 14:52:56 +0000 (12:52 -0200)
keyringer
lib/keyringer/actions/shell [new file with mode: 0755]

index 11b8aa106189b588f87492af6b9b402c797203ea..e65bef03562e5f57420a972632d34314cc9eff2e 100755 (executable)
--- a/keyringer
+++ b/keyringer
@@ -135,6 +135,7 @@ set -f
 export PREFERENCES="`dirname $CONFIG`/$KEYRING"
 export KEYRINGER_VERSION
 export CONFIG_VERSION
+export KEYRING
 
 # Set functions location
 if [ -e "`dirname $(readlink -f $0)`/lib/$NAME/functions" ]; then
diff --git a/lib/keyringer/actions/shell b/lib/keyringer/actions/shell
new file mode 100755 (executable)
index 0000000..c70d6bb
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Interactive shell.
+#
+
+# Load functions
+LIB="`dirname $0`/../functions"
+source "$LIB" || exit 1
+
+# While a "quit" command isn't entered, read STDIN
+while read -rep "keyringer:/> " STDIN; do
+  if [ "$STDIN" == "quit" ]; then
+    break
+  # If line is not empty or commented, process command
+  elif [[ -n "$STDIN" && "$STDIN" != "#"* ]]; then
+    keyringer "$KEYRING" $STDIN
+  fi
+done