diff --git a/README.md b/README.md index d2f9e5f..89eddc3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Similar to [password-store](https://git.zx2c4.com/password-store/about/), but wr ## Requirements - [gpg](https://gnupg.org/) -- tree +- [tree](https://oldmanprogrammer.net/source.php?dir=projects/tree) ###### Optional Requirements - [nano](https://www.nano-editor.org/) *(required only if environment variable `$EDITOR` is not set)* @@ -20,8 +20,8 @@ Similar to [password-store](https://git.zx2c4.com/password-store/about/), but wr ## Config Edit the source code to change these settings: -| Setting | Description | -| -------- | ------------------------------------------------------------------------------------------------------------------ | +| Setting | Description | +| ---------- | ---------------------------------------------------------------------------------------------------------------- | | `GPG_ID` | Default GPG key ID to use for encrypting/decrypting | | `GPG_OPTS` | Do not edit this unless you know what you are doing | | `METHOD` | Method used for the menu *("copy" will use xclip to copy passwords & "type" will use xdotool to type passwords)* | @@ -57,8 +57,7 @@ fi ``` Make it executable with `chmod +x $HOME/.gnupg/pinentry-wrapper` and then edit your `$HOME/.gnupg/gpg-agent.conf` to include `pinentry-program $HOME/.gnupg/pinentry-wrapper`. -## Mirrors -- [acid.vegas](https://git.acid.vegas/pass) -- [GitHub](https://github.com/acidvegas/pass) -- [GitLab](https://gitlab.com/acidvegas/pass) -- [SuperNETs](https://git.supernets.org/acidvegas/pass) \ No newline at end of file +___ + +###### Mirrors +[acid.vegas](https://git.acid.vegas/pass) • [GitHub](https://github.com/acidvegas/pass) • [GitLab](https://gitlab.com/acidvegas/pass) • [SuperNETs](https://git.supernets.org/acidvegas/pass) diff --git a/pass b/pass index 7540fd0..2568eb6 100755 --- a/pass +++ b/pass @@ -68,7 +68,7 @@ menu() { elif [ -f $cwd/$cmd ]; then if [ $METHOD = "copy" ]; then export PINENTRY_USER_DATA="dmenu" | gpg -d $GPG_OPTS $cwd/$cmd | dmenu "$@" | xclip -selection clipboard - sleep 3 && xclip -selection clipboard /dev/null + sleep 3 && xclip -selection clipboard /dev/nul elif [ $METHOD = "type" ]; then export PINENTRY_USER_DATA="dmenu" | gpg -d $GPG_OPTS $cwd/$cmd | dmenu "$@" | xdotool type --delay 3 "$D" fi @@ -103,17 +103,17 @@ show() { } # Main -[ ! $(command -v gpg) ] && echo "error: missing required packaged 'gpg'" && exit 1 -[ ! $(command -v tree) ] && echo "error: missing required packaged 'tree'" && exit 1 +command -v gpg >/dev/null || { echo "error: missing required package 'gpg'"; exit 1; } +command -v tree >/dev/null || { echo "error: missing required package 'tree'"; exit 1; } if [ "$#" = '1' ]; then if [ $1 = 'menu' ]; then - [ ! $(command -v dmenu) ] && echo "error: missing required packaged 'dmenu'" && exit 1 - [ ! $(command -v pinentry) ] && echo "error: missing required packaged 'pinentry'" && exit 1 - [ ! $(command -v pinentry-dmenu) ] && echo "error: missing required packaged 'pinentry-dmenu'" && exit 1 + command -v dmenu >/dev/null || { echo "error: missing required package 'dmenu'"; exit 1; } + command -v pinentry >/dev/null || { echo "error: missing required package 'pinentry'"; exit 1; } + command -v pinentry-dmenu >/dev/null || { echo "error: missing required package 'pinentry-dmenu'"; exit 1; } if [ $METHOD = "copy" ]; then - [ ! $(command -v xclip) ] && echo "error: missing required packaged 'xclip'" && exit 1 + command -v dmenu >/dev/null || { echo "error: missing required package 'xclip'"; exit 1; } elif [ $METHOD = 'type' ]; then - [ ! $(command -v xdotool) ] && echo "error: missing required packaged 'xdotool'" && exit 1 + command -v xdotool >/dev/null || { echo "error: missing required package 'xdotool'"; exit 1; } else echo "error: invalid menu method (must be 'copy' or 'type')" exit 1 @@ -128,9 +128,9 @@ elif [ "$#" = '2' ]; then elif [ "$1" = 'gen' ]; then generate $2 elif [ "$1" = 'otp' ]; then - [ ! $(command -v oathtool) ] && echo "error: missing required packaged 'oathtool'" && exit 1 + command -v oathtool >/dev/null || { echo "error: missing required package 'oathtool'"; exit 1; } otp $2 fi else tree -NCl --noreport $PASS_DIR 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' -fi \ No newline at end of file +fi