]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Adding 'open' action
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 15:49:53 +0000 (12:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 17 Aug 2013 15:49:53 +0000 (12:49 -0300)
debian/control
share/keyringer/edit
share/keyringer/open [new symlink]
share/man/keyringer.1.mdwn

index b386532e321fad967a46ab09151e6b603d06adee..689c7d9d4ccb842efe087906bba340e1316c456b 100644 (file)
@@ -11,7 +11,7 @@ Homepage: https://keyringer.pw
 Package: keyringer
 Architecture: all
 Depends: ${shlibs:Depends}, ${misc:Depends}, bash, git-core, gnupg, grep, gawk, coreutils, sed
-Recommends: openssl
+Recommends: openssl, xdg-utils
 Description: Distributed secret management using GPG and git
  Keyringer lets you manage and share secrets using GPG and git in a distributed
  fashion. It has custom commands to encrypt, decrypt, recrypt, create key pairs,
index 0604d7ea337532a6c77bb230cbfd1a09e28a4a55..fe05ecc7ee390292aab91cd23fb8fdfbeda23809 100755 (executable)
@@ -22,10 +22,21 @@ keyringer_set_tmpfile edit
 # Decrypt the information to the file
 $GPG --yes -o "$TMPWORK" --use-agent -d "$KEYDIR/$FILE"
 
+if [ "$BASENAME" == "edit" ]; then
+  APP="$EDITOR"
+elif [ "$BASENAME" == "open" ]; then
+  if which xdg-open &> /dev/null; then
+    APP="xdg-open"
+  else
+    echo "You should have xdg-open application to perform this action, aborting."
+    exit 1
+  fi
+fi
+
 # Prompt
-echo "Press any key to open the decrypted data in $EDITOR, Ctrl-C to abort"
+echo "Press any key to open the decrypted data with $APP, Ctrl-C to abort"
 read key
-$EDITOR "$TMPWORK"
+$APP "$TMPWORK"
 
 # Encrypt again
 $GPG --yes -o "$KEYDIR/$FILE" --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") "$TMPWORK"
diff --git a/share/keyringer/open b/share/keyringer/open
new file mode 120000 (symlink)
index 0000000..8491ab9
--- /dev/null
@@ -0,0 +1 @@
+edit
\ No newline at end of file
index 99abd60f7abd607ad6f9d9be6218482f2924c4cf..23b8d85786ac6f0bf356d50de9f153ec9eda6125 100644 (file)
@@ -75,6 +75,9 @@ encrypt-batch <*SECRET*>
 genpair <*ssh*|*gpg*|*ssl*|*ssl-self*> [*options*]
 :  Wrapper to generete encryption keypairs, useful for automated key deployment.
 
+open <*SECRET*>
+:  Open a secret using xdg-open.
+
 recrypt <*SECRET*>
 :  Recrypts a secret by decrypting it and recrypting again. Useful when users are added
    into recipient configuration. If no *SECRET* is given, all secrets in the repository