diff --git a/Makefile b/Makefile index 4501190..1b2feda 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ -include config.mk +PREFIX=/usr/local install: install-bin install-examples install-man uninstall: uninstall-bin uninstall-examples uninstall-man install-bin: - install -Dm${EXEC_MODE} kanako ${PREFIX}/bin/kanako + install -Dm0755 kanako ${DESTDIR}${PREFIX}/bin/kanako install-examples: - install -Dm${FILE_MODE} kanako.conf.example ${PREFIX}/share/examples/kanako/kanako.conf + install -Dm0600 kanako.conf.example ${DESTDIR}${PREFIX}/share/examples/kanako/kanako.conf install-man: - install -Dm${FILE_MODE} kanako.mdoc ${PREFIX}/share/man/man1/kanako.1 - install -Dm${FILE_MODE} kanako.conf.mdoc ${PREFIX}/share/man/man5/kanako.conf.5 + install -Dm0600 kanako.mdoc ${DESTDIR}${PREFIX}/share/man/man1/kanako.1 + install -Dm0600 kanako.conf.mdoc ${DESTDIR}${PREFIX}/share/man/man5/kanako.conf.5 uninstall-bin: rm -f ${PREFIX}/bin/kanako uninstall-examples: diff --git a/README.md b/README.md index f12bb2f..0a335bb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ the adaptable password manager. named after [Kanako Yasaka](https://en.touhouwik ## Dependencies * Any of the above, depending how you configured it -* `ls(1)` or `tree(1)` for printing a list +* `tree(1)` for printing a list * `mandoc(1)` for documentation ## Add-ons @@ -31,7 +31,6 @@ from oath-toolkit. * [Beerware License (Revision 42.1)](COPYING) ## Related software -* [akoizumi/ayu](https://git.shelltalk.net/akoizumi/ayu) [predecessor] * [beastie/aps](https://codeberg.org/beastie/aps) * [biox/pa](https://github.com/biox/pa) * [e-zk/page](https://github.com/e-zk/page) diff --git a/config.mk b/config.mk deleted file mode 100644 index 6f2c1f4..0000000 --- a/config.mk +++ /dev/null @@ -1,3 +0,0 @@ -EXEC_MODE=0755 -FILE_MODE=0600 -PREFIX=/usr/local diff --git a/kanako b/kanako index cf26757..62fd5e5 100755 --- a/kanako +++ b/kanako @@ -1,5 +1,5 @@ #!/bin/sh -# $TheSupernovaDuo: kanako,v 1.9 2023/5/18 21:9:33 yakumo_izuru Exp $ +# $TheSupernovaDuo: kanako,v 2.0 2023/08/23 23:33:45 yakumo_izuru Exp $ readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}" readonly kanako_key_dir="${kanako_key_dir:-$HOME/.kanako}" @@ -22,20 +22,20 @@ else exit 1 fi -fn_copy() { - fn_view $1 | "${kanako_clip_cmd}" +copy() { + view $1 | "${kanako_clip_cmd}" } -fn_edit() { +edit() { ${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc > ${1%%.enc} "${EDITOR}" "${1%%.enc}" ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} > ${1%%.enc}.enc rm "${1%%.enc}" } -fn_list() { - "${kanako_list_cmd}" "${kanako_store_dir}/" +list() { + $(which tree) "${kanako_store_dir}/" } -fn_new() { - test -d $1 && fn_usage && exit 1 +new() { + test -d $1 && usage && exit 1 tmpfile="$(mktemp)" "${EDITOR}" "${tmpfile}" @@ -44,34 +44,34 @@ fn_new() { ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} > ${1%%.enc}.enc rm ${tmpfile} } -fn_trash_directory() { - rm -rf "$1" +trash_directory() { + rm -r -I "$1" } -fn_trash_file() { - rm -f "${1}${2}".enc +trash_file() { + rm -i "${1}${2}".enc } -fn_usage() { +usage() { printf "Usage: %s [-c|-e|-h|-l|-n|-R|-r|-v [file or directory]]\n" "$0" printf "The arguments for all switches except for '-h' are relative to\n" printf "\t\$kanako_store_dir which is set to %s\n\n" "{$kanako_store_dir}" } -fn_view() { +view() { if [ -f "${1%%.enc}".enc ]; then ${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc elif [ -d "${1:-.}" ]; then - ${kanako_list_cmd} "${1:-.}" + $(which tree) "${1:-.}" else - fn_usage + usage fi } case $1 in - -c) fn_copy $2 ;; - -e) fn_edit $2 ;; - -l) fn_list ;; - -n) fn_new $2 ;; - -R) fn_trash_directory $2 ;; - -r) fn_trash_file $2 ;; - -v) fn_view $2 ;; - *) fn_usage ;; + -c) copy $2 ;; + -e) edit $2 ;; + -l) list ;; + -n) new $2 ;; + -R) trash_directory $2 ;; + -r) trash_file $2 ;; + -v) view $2 ;; + *) usage ;; esac diff --git a/kanako.conf.example b/kanako.conf.example index 5b99a0c..60d6c3b 100644 --- a/kanako.conf.example +++ b/kanako.conf.example @@ -2,7 +2,6 @@ #kanako_clip_cmd="xclip -i" #kanako_clip_cmd="wl-copy --primary" -#kanako_list_cmd="tree" #kanako_menu_cmd="dmenu" ## age @@ -23,4 +22,4 @@ ## salty #kanako_encrypt_cmd="salty" #kanako_encrypt_args="-e -r $(cat ${kanako_key_dir}/pub.slt)" -#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.slt" \ No newline at end of file +#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.slt" diff --git a/kanako.conf.mdoc b/kanako.conf.mdoc index 126dbaf..66c0bd4 100644 --- a/kanako.conf.mdoc +++ b/kanako.conf.mdoc @@ -1,4 +1,4 @@ -.Dd Aftermath 41, 3188 +.Dd $Mdocdate$ .Dt KANAKO.CONF 5 .Os .Sh NAME @@ -19,9 +19,6 @@ passed to kanako_encrypt_cmd .It kanako_encrypt_cmd Encryption executable to be used with the program -.It kanako_list_cmd -Listing executable to -be used with the -l switch .It kanako_menu_cmd Menu executable to be used with kanako_menu @@ -29,5 +26,5 @@ be used with kanako_menu .Sh SEE ALSO .Xr kanako 1 .Sh AUTHORS -.An Aoi Koizumi Aq Mt koizumi.aoi@kyoko-project.wer.ee +.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja diff --git a/kanako.mdoc b/kanako.mdoc index ab73738..1acb746 100644 --- a/kanako.mdoc +++ b/kanako.mdoc @@ -1,4 +1,4 @@ -.Dd Bureaucracy 73, 3188 +.Dd $Mdocdate$ .Dt KANAKO 1 .Os .Sh NAME @@ -33,9 +33,11 @@ Edit an entry .It -l List all entries .It -r -Remove single entries +Remove single entries, +will prompt for confirmation .It -R -Remove recursively a directory w/ entries +Remove recursively a directory w/ entries, +will prompt for confirmation .It -v View an entry .Bl @@ -54,7 +56,7 @@ View an entry .%D 1983 .Re .Sh AUTHORS -.An Aoi Koizumi Aq Mt koizumi.aoi@kyoko-project.wer.ee +.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja .Sh BUGS Under the Wayland display protocol, the clipboard subcommand won't work, diff --git a/mkfile b/mkfile index 165cf04..52b22ca 100644 --- a/mkfile +++ b/mkfile @@ -1,15 +1,15 @@ -