Index: /trunk/addons/kanako-menu
===================================================================
--- /trunk/addons/kanako-menu	(revision 27)
+++ /trunk/addons/kanako-menu	(revision 28)
@@ -1,13 +1,14 @@
 #!/bin/sh -e
-# $TheSupernovaDuo: kanako,v 1.9 2023/5/18 21:9:33 yakumo_izuru Exp $
-readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
-readonly kanako_store_dir="${kanako_store_dir:-$HOME/.kanako-store}"
+# $YakumoLabs, kanako-menu v2.0, 2025/05/17 15:51:40 yakumo_izuru Exp $
 
-if test -f "${kanako_conf_dir}"/kanako.conf; then
-    . "${kanako_conf_dir}"/kanako.conf
-else
-    echo "Configuration file has not been found!"
-    exit 1
-fi
+kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
+kanako_store_dir="${kanako_store_dir:-$HOME/.kanako-store}"
 
-find . -name '*.enc' | sort | sed 's,^\./,,;s,\.enc$,,' | "${kanako_menu_cmd}" | xargs $(which kanako) -c
+# Load configuration file
+[ -f "${kanako_conf_dir}/kanako.conf" ] && . ${kanako_conf_dir}/kanako.conf || \
+	printf "\033[0;31m%s\033[0m\n" "Unable to load configuration file" && exit 1
+
+# Choice of dynamic menu program
+[ -z "${kanako_menu_cmd}" ] && kanako_menu_cmd="dmenu"
+
+find ${kanako_store_dir} -name '*.enc' | sort | sed 's,^\./,,;s,\.enc$,,' | ${kanako_menu_cmd} | xargs kanako -c
Index: /trunk/kanako
===================================================================
--- /trunk/kanako	(revision 27)
+++ /trunk/kanako	(revision 28)
@@ -7,12 +7,12 @@
 
 _die() {
-    printf "\033[0;31m%s\033[0m\n" "$*" >&2
-    exit 1
+	printf "\033[0;31m%s\033[0m\n" "$*" >&2
+	exit 1
 }
 _info() {
-    printf "\033[0;32m%s\033[0m\n" "$*"
+	printf "\033[0;32m%s\033[0m\n" "$*"
 }
 _warn() {
-    printf "\033[0;33m%s\033[0m\n" "$*"
+	printf "\033[0;33m%s\033[0m\n" "$*"
 }
 
@@ -24,74 +24,74 @@
 }
 edit() {
-    if [ -f ${1%%.enc}.enc ]; then
-	${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc >${1%%.enc}
-	"${EDITOR:-${EDITOR:-vi}}" "${1%%.enc}"
-	${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} >${1%%.enc}.enc
-	rm "${1%%.enc}"
-    else
-	_warn "${1%%.enc}.enc does not exist, maybe there was a typo on your end?"
-    fi
+	if [ -f ${1%%.enc}.enc ]; then
+		${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc >${1%%.enc}
+		"${EDITOR:-${EDITOR:-vi}}" "${1%%.enc}"
+		${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} >${1%%.enc}.enc
+		rm "${1%%.enc}"
+	else
+		_warn "${1%%.enc}.enc does not exist, maybe there was a typo on your end?"
+	fi
 }
 gen() {
-    printf "%s\n" $(strings </dev/urandom | dd bs=1 count="${1:-30}" 2>/dev/null | tr -d ' \t\n\r')
+	printf "%s\n" $(strings </dev/urandom | dd bs=1 count="${1:-30}" 2>/dev/null | tr -d ' \t\n\r')
 }
 list() {
-    if [ -z "$(command -v tree)" ]; then
-	_die "Required dependency 'tree' not found"
+	if [ -z "$(command -v tree)" ]; then
+		_die "Required dependency 'tree' not found"
 
-    fi
-    if [ -z "$1" ]; then
-	tree "${kanako_store_dir}/" | sed 's/\.enc//g'
-    else
-	tree "${1:-.}" | sed 's/\.enc//g'
-    fi
+	fi
+	if [ -z "$1" ]; then
+		tree "${kanako_store_dir}/" | sed 's/\.enc//g'
+	else
+		tree "${1:-.}" | sed 's/\.enc//g'
+	fi
 }
 new() {
-    [ -d "$1" ] && usage
-    tmpfile="$(mktemp)"
-    "${EDITOR:-${EDITOR:-vi}}" "${tmpfile}"
-    mkdir -p "$(dirname "$1")"
-    ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} >${1%%.enc}.enc
-    rm ${tmpfile}
+	[ -d "$1" ] && usage
+	tmpfile="$(mktemp)"
+	"${EDITOR:-${EDITOR:-vi}}" "${tmpfile}"
+	mkdir -p "$(dirname "$1")"
+	${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} >${1%%.enc}.enc
+	rm ${tmpfile}
 }
 otp() {
-    if [ -z "$(command -v oathtool)" ]; then
-	_die "Required dependency 'oathtool' not found"
-    fi
-    totp_seed=$(view "$1" | grep 'totp: ' | head -n1 | cut -d' ' -f2)
-    if ! [ -z ${totp_seed} ]; then
-	oathtool --totp -b ${totp_seed}
-    fi
+	if [ -z "$(command -v oathtool)" ]; then
+		_die "Required dependency 'oathtool' not found"
+	fi
+	totp_seed=$(view "$1" | grep 'totp: ' | head -n1 | cut -d' ' -f2)
+	if ! [ -z ${totp_seed} ]; then
+		oathtool --totp -b ${totp_seed}
+	fi
 }
 delete_directory() {
-    _warn "Will be removing $1"
-    _warn "Are you okay with that?"
-    read junk
-    case ${junk} in
-	n|N) _info "Abort" ;;
-	y|Y) rm -rf "${1}" && _info "Removed $1";;
-    esac
+	_warn "Will be removing $1"
+	_warn "Are you okay with that?"
+	read junk
+	case ${junk} in
+		n | N) _info "Abort" ;;
+		y | Y) rm -rf "${1}" && _info "Removed $1" ;;
+	esac
 }
 delete_file() {
-    _warn "Will be removing $1"
-    _warn "Are you okay with that?"
-    read junk
-    case ${junk} in
-	n|N) _info "Abort" ;;
-	y|Y) rm -f "${1}.enc" && _info "Removed $1/$2";;
-    esac
+	_warn "Will be removing $1"
+	_warn "Are you okay with that?"
+	read junk
+	case ${junk} in
+		n | N) _info "Abort" ;;
+		y | Y) rm -f "${1}.enc" && _info "Removed $1/$2" ;;
+	esac
 }
 usage() {
-    _info "Usage: kanako [-ceglnorRv] args"
-    _info "The arguments for all switches are relative to \${kanako_store_dir}"
-    _info "which is located at ${kanako_store_dir}"
-    exit
+	_info "Usage: kanako [-ceglnorRv] args"
+	_info "The arguments for all switches are relative to \${kanako_store_dir}"
+	_info "which is located at ${kanako_store_dir}"
+	exit
 }
 view() {
-    if [ -f "${1%%.enc}".enc ]; then
-	${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc
-    else
-	_die "${1%%.enc} was not found"
-    fi
+	if [ -f "${1%%.enc}".enc ]; then
+		${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc
+	else
+		_die "${1%%.enc} was not found"
+	fi
 }
 
@@ -100,14 +100,14 @@
 
 case ${cmd} in
-    -c) copy ${arg} ;;
-    -e) edit ${arg} ;;
-    -g) gen ${arg} ;;
-    -h) usage ;;
-    -l) list ${arg} ;;
-    -n) new ${arg} ;;
-    -o) otp ${arg} ;;
-    -r) delete_file ${arg} ;;
-    -R) delete_directory ${arg} ;;
-    -v) view ${arg} ;;
-    *) usage ;;
+	-c) copy ${arg} ;;
+	-e) edit ${arg} ;;
+	-g) gen ${arg} ;;
+	-h) usage ;;
+	-l) list ${arg} ;;
+	-n) new ${arg} ;;
+	-o) otp ${arg} ;;
+	-r) delete_file ${arg} ;;
+	-R) delete_directory ${arg} ;;
+	-v) view ${arg} ;;
+	*) usage ;;
 esac
