add: shortcut handler for kitty

This commit is contained in:
Jamie Albert
2025-11-13 20:54:37 +00:00
parent ee0be951e3
commit 812d192552
4 changed files with 108 additions and 25 deletions

View File

@@ -3,8 +3,8 @@
# @file_name: dao.sh
# @description: main script handle for dao
# @date: 2025-11-12
# @version: 0.0.1
# @usage: ./dao.sh {update|transfer|pwgen|mount|firewall} [args]
# @version: 0.1.0
# @usage: ./dao.sh {kitty|mount|pwgen|update} [args]
#
# @author: Jamie Albert
# @author_contact: <mailto:jamie.albert@flatmail.me
@@ -40,36 +40,33 @@ exit 0
}
[[ "${1:-}" == "-h" || "${1:-}" == "--help" ]] && show_help
declare -g COMMAND=${1:-}
shift || true
# ---
# shellcheck disable=1091
# ---
setup() {
main() {
. /usr/local/share/dao/libs/libs_dao.sh
. /usr/local/share/dao/config/dao.conf
}
declare -g COMMAND=$1
shift
main() {
setup
case "${COMMAND}" in
update)
"${DAO_SCRIPTS_DIR}/on_demand/update.sh" "$@"
;;
transfer)
"${DAO_SCRIPTS_DIR}/on_demand/transfer.sh" "$@"
;;
pwgen)
"${DAO_SCRIPTS_DIR}/on_demand/pwgen.sh" "$@"
kitty)
"${DAO_SCRIPTS_DIR}/patches/kitty_handler.sh" "$@"
;;
mount)
"${DAO_SCRIPTS_DIR}/reboot/mount.sh" "$@"
;;
pwgen)
"${DAO_SCRIPTS_DIR}/on_demand/pwgen.sh" "$@"
;;
update)
"${DAO_SCRIPTS_DIR}/on_demand/update.sh" "$@"
;;
"")
dao::error 1 "No command provided. Use -h for help." >&2
;;
*)
echo "Usage: dao {update|transfer|pwgen|mount|firewall} [args]"
exit 1
dao::error 1 "Unknown command: ${COMMAND}" >&2
;;
esac
}

View File

@@ -6,7 +6,7 @@ _dao_completion() {
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
mapfile -t commands < <(printf "update\ntransfer\npwgen\nmount\n")
mapfile -t commands < <(printf "kitty\nmount\npwgen\nupdate\n")
case "${COMP_CWORD}" in
1)
@@ -17,8 +17,8 @@ _dao_completion() {
pwgen)
mapfile -t COMPREPLY < <(compgen -W "3 4 5 6 7 8 9 10" -- "${cur}")
;;
transfer)
mapfile -t COMPREPLY < <(compgen -W "-d -u -uc -ur" -- "${cur}")
kitty)
mapfile -t COMPREPLY < <(compgen -W "--list --new-instance --new-tab" -- "${cur}")
;;
*) ;;
esac