small pixel drawing of a pufferfish pa

add pa git (#44)

arĉi arcxi@dismail.de
Tue, 01 Oct 2024 02:13:54 +0200
commit

ff521730586d5aadcfc6b507e8842f72ed377b3e

parent

fcffa08ab371a9d24a72cfe91144f7ec11a4a7f3

2 files changed, 21 insertions(+), 8 deletions(-)

jump to
M READMEREADME

@@ -27,6 +27,7 @@ commands:

[a]dd [name] - Add a password entry. [d]el [name] - Delete a password entry. [e]dit [name] - Edit a password entry with vi. + [g]it [cmd] - Run git command in the password dir. [l]ist - List all entries. [s]how [name] - Show password for an entry.

@@ -53,6 +54,12 @@ <opens $EDITOR or vi>

$ pa del test Delete password 'test'? [y/N]: y + + $ pa git log --oneline + bbe85dc (HEAD -> main) delete 'test' + b597c04 edit 'test' + cba20cc add 'test' + ef76f7e initial commit faq
M papa

@@ -179,6 +179,7 @@ commands:

[a]dd [name] - Add a password entry. [d]el [name] - Delete a password entry. [e]dit [name] - Edit a password entry with ${EDITOR:-vi}. + [g]it [cmd] - Run git command in the password dir. [l]ist - List all entries. [s]how [name] - Show password for an entry.

@@ -197,14 +198,6 @@ die "age not found, install per https://age-encryption.org"

age_keygen=$(command -v age-keygen || command -v rage-keygen) || die "age-keygen not found, install per https://age-encryption.org" - - command=$1 - - # Combine the rest of positional arguments into - # a name and remove control characters from it - # so that a name can always be safely displayed. - shift - name=$(printf %s "$*" | LC_ALL=C tr -d '[:cntrl:]') basedir=${XDG_DATA_HOME:=$HOME/.local/share}/pa : "${PA_DIR:=$basedir/passwords}"

@@ -246,6 +239,19 @@ printf '%s\n' '*.age diff=age' >.gitattributes

git_add_and_commit . "initial commit" } + + command=$1 + shift + + glob "$command" 'g*' && { + git "$@" + exit $? + } + + # Combine the rest of positional arguments into + # a name and remove control characters from it + # so that a name can always be safely displayed. + name=$(printf %s "$*" | LC_ALL=C tr -d '[:cntrl:]') glob "$command" '[ades]*' && [ -z "$name" ] && die "Missing [name] argument"