Lazy commit
This commit is contained in:
43
cradle/usr/local/share/bash-completion/completions/dao.sh
Normal file
43
cradle/usr/local/share/bash-completion/completions/dao.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bash completion for dao command
|
||||
|
||||
_dao_completion() {
|
||||
local cur commands
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
mapfile -t commands < <(printf "update\ntransfer\npwgen\nmount\n")
|
||||
|
||||
case "${COMP_CWORD}" in
|
||||
1)
|
||||
mapfile -t COMPREPLY < <(compgen -W "${commands[*]}" -- "${cur}")
|
||||
;;
|
||||
2)
|
||||
case "${COMP_WORDS[1]}" in
|
||||
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}")
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
;;
|
||||
3)
|
||||
case "${COMP_WORDS[1]}" in
|
||||
pwgen)
|
||||
if [[ "${COMP_WORDS[2]}" =~ ^[0-9]+$ ]]; then
|
||||
mapfile -t COMPREPLY < <(compgen -W "- _ . space" -- "${cur}")
|
||||
fi
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _dao_completion dao.sh
|
||||
@@ -1,4 +0,0 @@
|
||||
REMOTE_HOST="root@hephaestus"
|
||||
REMOTE_PATH="/home/oc/docker_config/compose.yml"
|
||||
LOCAL_PATH="/tmp/${REMOTE_PATH##*/}"
|
||||
EDITOR="codium"
|
||||
13
cradle/usr/local/share/dao/config/dao.conf
Normal file
13
cradle/usr/local/share/dao/config/dao.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
# -- dao.sh
|
||||
DAO_USER="jamie"
|
||||
DAO_USER_HOME="/home/${DAO_USER}"
|
||||
DAO_INSTALL_DIR="${DAO_USER_HOME}/dao"
|
||||
DAO_SCRIPTS_DIR="${DAO_INSTALL_DIR}/scripts"
|
||||
DAO_STORAGE_DIR="${DAO_INSTALL_DIR}/storage"
|
||||
|
||||
# --- jade.sh
|
||||
JADE_REMOTE_HOST="root@hephaestus"
|
||||
JADE_REMOTE_PATH="/home/oc/docker_config/compose.yml"
|
||||
JADE_LOCAL_PATH="/tmp/${JADE_REMOTE_PATH##*/}"
|
||||
JADE_EDITOR="codium"
|
||||
@@ -16,7 +16,7 @@ readonly GREEN=$'\033[0;38;5;108m'
|
||||
readonly YELLOW=$'\033[1;38;5;214m'
|
||||
readonly NC=$'\033[0m'
|
||||
|
||||
cradle::error() {
|
||||
dao::error() {
|
||||
declare error_msg exit_code="${1}"
|
||||
shift
|
||||
printf -v error_msg 'error[%d]: %s\n' "${exit_code}" "$*"
|
||||
@@ -24,13 +24,13 @@ cradle::error() {
|
||||
exit "${exit_code}"
|
||||
}
|
||||
|
||||
cradle::info() {
|
||||
dao::info() {
|
||||
declare info_msg
|
||||
printf -v info_msg '%s\n' "$*"
|
||||
echo -ne "${GREEN}[i]${NC}: ${info_msg}"
|
||||
}
|
||||
|
||||
cradle::warn() {
|
||||
dao::warn() {
|
||||
declare warn_msg
|
||||
printf -v warn_msg '%s\n' "$*"
|
||||
echo -ne "${YELLOW}[w]${NC}: ${warn_msg}"
|
||||
Reference in New Issue
Block a user