commit fc2f7db3b2f5b6f0258e94143ba88378dd58f5c5
parent 6d923b6894eb8402a5f1e2e43e4249744ac06064
Author: kar <kar@13f0.net>
Date: Wed, 1 Jan 2025 14:17:48 -0500
rename angou to kasi
Having a Japanese word as a project name sounds very childish when not
I am not Japanese myself.
Using a conlang is childish too when I don't know any words in it? I
refuse to believe that.
Diffstat:
8 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/README b/README
@@ -1,5 +1,5 @@
-angou (暗号)
-============
+kasi ("veil"/"conceal" in Esperanto)
+====================================
A simple password manager written in POSIX shell.
Dependencies
@@ -9,13 +9,13 @@ Dependencies
- tree (for listing all your passwords and their directories)
- a simple version is available in https://github.com/pyr/tree
and in OpenBSD's ports
- - can possibly be replaced with ls if you add ANGOU_LIST in your ~/.profile
+ - can possibly be replaced with ls if you add KASI_LIST in your ~/.profile
- xsel (for copying password to clipboard, but can be changed to a different
- command with the ANGOU_CLIPBOARD command that accepts stdin)
+ command with the KASI_CLIPBOARD command that accepts stdin)
- a password generator
- script uses contrib/random from this repo by default and expects it in your
path
- - can change by setting ANGOU_GEN_USER and ANGOU_GEN_PASS in your ~/.profile
+ - can change by setting KASI_GEN_USER and KASI_GEN_PASS in your ~/.profile
Configuration
-------------
@@ -23,17 +23,17 @@ In your ~/.profile or wherever you set environment variables, add something
like this if you use age:
export AGE_KEY=/nas/ssh/id_ed25519
export AGE_PUB=${AGE_KEY}.pub
-export ANGOU_DIR=/nas/angou-age
-export ANGOU_ENCRYPT="age -R $AGE_PUB"
-export ANGOU_DECRYPT="age -d -i $AGE_KEY -o -"
+export KASI_DIR=/nas/kasi-age
+export KASI_ENCRYPT="age -R $AGE_PUB"
+export KASI_DECRYPT="age -d -i $AGE_KEY -o -"
If you use GnuPG, then add:
export GPG_ID="user@email.tld" # or your key id
-export ANGOU_DECRYPT="gpg -qd"
-export ANGOU_ENCRYPT="gpg -er $GPG_ID -o -"
+export KASI_DECRYPT="gpg -qd"
+export KASI_ENCRYPT="gpg -er $GPG_ID -o -"
For some other file encryptor, you'd need to be able to output the encrypted
-file to stdout or change the last line of edit() that runs $ANGOU_ENCRYPT.
+file to stdout or change the last line of edit() that runs $KASI_ENCRYPT.
Why should I use this over password-store?
------------------------------------------
@@ -41,7 +41,7 @@ Don't. For a serious answer, it's because this doesn't depend on bash.
Migrating from password-store
-----------------------------
-Set the ANGOU_DIR environment variable to your password store directory.
+Set the KASI_DIR environment variable to your password store directory.
Auto-complete
-------------
diff --git a/angou b/angou
@@ -1,96 +0,0 @@
-#!/bin/sh -e
-
-# sets the directory with all your passwords
-ANGOU_DIR=${ANGOU_DIR:-"$HOME/.angou/"}
-# sets the command to copy into your clipboard (must accept stdin)
-ANGOU_CLIPBOARD=${ANGOU_CLIPBOARD:-"xsel -i"}
-# sets command to use when listing directory structure
-ANGOU_LIST=${ANGOU_LIST:-"tree"}
-# custom command for generating passwords/users
-ANGOU_GEN_PASS=${ANGOU_GEN_PASS:-"random pass"}
-ANGOU_GEN_USER=${ANGOU_GEN_USER:-"random user"}
-
-mkdir -p "$ANGOU_DIR"
-cd "$ANGOU_DIR"
-
-# decrypt and print a password from ANGOU_DIR or print the directory structure
-view() {
- if [ -f "$1" ]; then
- $ANGOU_DECRYPT "$1"
- elif [ -d "${1:-.}" ]; then
- tree "${1:-.}"
- else
- usage
- exit 1
- fi
-}
-
-# view the first line
-view_single() {
- [ ! -f "$1" ] && usage && exit 1
-
- view "$1" | sed 1q | tr -d \\n
-}
-
-# copy the first line from view to clipboard
-copy() {
- [ ! -f "$1" ] && usage && exit 1
-
- view_single "$1" | $ANGOU_CLIPBOARD
-}
-
-# create new or existing password in ANGOU_DIR
-edit() {
- [ -d "$1" ] && usage && exit 1
-
- tmpfile="$(mktemp)"
-
- if [ "$2" = "generate" ]; then
- $ANGOU_GEN_PASS >"$tmpfile"
- echo "Username: $($ANGOU_GEN_USER)" >>"$tmpfile"
- fi
-
- # edit a copy of a password if it already exists
- [ -f "$1" ] && $ANGOU_DECRYPT "$1" > "$tmpfile"
-
- ${VISUAL:-${EDITOR:-ed}} "$tmpfile"
-
- mkdir -p "$(dirname "$1")"
- $ANGOU_ENCRYPT "$tmpfile" >"$1"
-}
-
-totp_view() {
- [ -d "$1" ] && usage && exit 1
-
- secret=$(view "$1" | grep TOTP | cut -d' ' -f 2)
- oathtool -b --totp "$secret"
-}
-
-totp() {
- totp_view "$1" | tr -d '\n' | $ANGOU_CLIPBOARD
-}
-
-# print usage
-usage() {
- printf "Usage: %s [help|copy|edit|generate|view|view_single [file or directory]]\n" "$0"
- printf "\tThe edit and copy command expects a file as an argument,\n"
- printf "\twhile the view command expects a directory as an argument.\n"
- printf "\tThe arguments for view and edit are relative to\n"
- printf "\t\$ANGOU_DIR which is currently set to %s\n\n" "$ANGOU_DIR"
-
- printf "\tThe view command is the default command if only a file or\n"
- printf "\tdirectory is passed as an argument\n"
-}
-
-option="$1"
-case "$option" in
- help) usage ;;
- copy) copy "$2" ;;
- edit) edit "$2" ;;
- generate) edit "$2" generate ;;
- view) view "$2" ;;
- pass) view_single "$2" ;;
- totp_view) totp_view "$2" ;;
- totp) totp "$2" ;;
- *) view "$1" ;;
-esac
diff --git a/contrib/angoumenu b/contrib/angoumenu
@@ -1,14 +0,0 @@
-#!/bin/sh
-ANGOU_DIR="${ANGOU_DIR:-~/.angou}"
-DMENU="dmenu"
-
-cd "$ANGOU_DIR"
-file=$(find . -type f -printf '%P\n' | sort | sed 's,^\./,,' | $DMENU)
-
-if [ -z "$1" ]; then
- angou copy "$file"
-elif [ "$1" = "totp" ]
- angou totp "$file"
-else
- exit 1
-fi
diff --git a/contrib/autocomplete.ksh b/contrib/autocomplete.ksh
@@ -1,4 +1,4 @@
#!/bin/ksh
-set -A complete_angou_1 -- help copy edit view pass generate
-set -A complete_angou_2 -- $(find ${ANGOU_DIR:-~/.angou} -type f | sort \
- | sed s,${ANGOU_DIR}/,, | sed s,\\.gpg$,,)
+set -A complete_kasi_1 -- help copy edit view pass generate
+set -A complete_kasi_2 -- $(find ${KASI_DIR:-~/.kasi} -type f | sort \
+ | sed s,${KASI_DIR}/,, | sed s,\\.gpg$,,)
diff --git a/contrib/autocomplete.zsh b/contrib/autocomplete.zsh
@@ -1,10 +1,10 @@
-#compdef angou
+#compdef kasi
passwords() {
- files=("${(f)$(find ${ANGOU_DIR:-$HOME/.angou} -type f -printf '%P\n' | sort)}")
+ files=("${(f)$(find ${KASI_DIR:-$HOME/.kasi} -type f -printf '%P\n' | sort)}")
_multi_parts / files
}
_arguments \
- '1:angou commands:(copy edit generate help pass view totp totp_view)' \
+ '1:kasi commands:(copy edit generate help pass view totp totp_view)' \
'2:passwords:passwords'
diff --git a/contrib/kasimenu b/contrib/kasimenu
@@ -0,0 +1,14 @@
+#!/bin/sh
+KASI_DIR="${KASI_DIR:-~/.kasi}"
+DMENU="dmenu"
+
+cd "$KASI_DIR"
+file=$(find . -type f -printf '%P\n' | sort | sed 's,^\./,,' | $DMENU)
+
+if [ -z "$1" ]; then
+ kasi copy "$file"
+elif [ "$1" = "totp" ]
+ kasi totp "$file"
+else
+ exit 1
+fi
diff --git a/kasi b/kasi
@@ -0,0 +1,96 @@
+#!/bin/sh -e
+
+# sets the directory with all your passwords
+KASI_DIR=${KASI_DIR:-"$HOME/.kasi/"}
+# sets the command to copy into your clipboard (must accept stdin)
+KASI_CLIPBOARD=${KASI_CLIPBOARD:-"xsel -i"}
+# sets command to use when listing directory structure
+KASI_LIST=${KASI_LIST:-"tree"}
+# custom command for generating passwords/users
+KASI_GEN_PASS=${KASI_GEN_PASS:-"random pass"}
+KASI_GEN_USER=${KASI_GEN_USER:-"random user"}
+
+mkdir -p "$KASI_DIR"
+cd "$KASI_DIR"
+
+# decrypt and print a password from KASI_DIR or print the directory structure
+view() {
+ if [ -f "$1" ]; then
+ $KASI_DECRYPT "$1"
+ elif [ -d "${1:-.}" ]; then
+ tree "${1:-.}"
+ else
+ usage
+ exit 1
+ fi
+}
+
+# view the first line
+view_single() {
+ [ ! -f "$1" ] && usage && exit 1
+
+ view "$1" | sed 1q | tr -d \\n
+}
+
+# copy the first line from view to clipboard
+copy() {
+ [ ! -f "$1" ] && usage && exit 1
+
+ view_single "$1" | $KASI_CLIPBOARD
+}
+
+# create new or existing password in KASI_DIR
+edit() {
+ [ -d "$1" ] && usage && exit 1
+
+ tmpfile="$(mktemp)"
+
+ if [ "$2" = "generate" ]; then
+ $KASI_GEN_PASS >"$tmpfile"
+ echo "Username: $($KASI_GEN_USER)" >>"$tmpfile"
+ fi
+
+ # edit a copy of a password if it already exists
+ [ -f "$1" ] && $KASI_DECRYPT "$1" > "$tmpfile"
+
+ ${VISUAL:-${EDITOR:-ed}} "$tmpfile"
+
+ mkdir -p "$(dirname "$1")"
+ $KASI_ENCRYPT "$tmpfile" >"$1"
+}
+
+totp_view() {
+ [ -d "$1" ] && usage && exit 1
+
+ secret=$(view "$1" | grep TOTP | cut -d' ' -f 2)
+ oathtool -b --totp "$secret"
+}
+
+totp() {
+ totp_view "$1" | tr -d '\n' | $KASI_CLIPBOARD
+}
+
+# print usage
+usage() {
+ printf "Usage: %s [help|copy|edit|generate|view|view_single [file or directory]]\n" "$0"
+ printf "\tThe edit and copy command expects a file as an argument,\n"
+ printf "\twhile the view command expects a directory as an argument.\n"
+ printf "\tThe arguments for view and edit are relative to\n"
+ printf "\t\$KASI_DIR which is currently set to %s\n\n" "$KASI_DIR"
+
+ printf "\tThe view command is the default command if only a file or\n"
+ printf "\tdirectory is passed as an argument\n"
+}
+
+option="$1"
+case "$option" in
+ help) usage ;;
+ copy) copy "$2" ;;
+ edit) edit "$2" ;;
+ generate) edit "$2" generate ;;
+ view) view "$2" ;;
+ pass) view_single "$2" ;;
+ totp_view) totp_view "$2" ;;
+ totp) totp "$2" ;;
+ *) view "$1" ;;
+esac
diff --git a/angou.1 b/kasi.1