#!/bin/sh -e
# $YakumoLabs, kanako-menu v2.0, 2025/05/17 15:51:40 yakumo_izuru Exp $

kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}"
kanako_store_dir="${kanako_store_dir:-$HOME/.kanako-store}"

# 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
