rename project to runaway
This commit is contained in:
+8
-8
@@ -1,4 +1,4 @@
|
||||
CONFIG_FILE="$HOME/.unleash.conf"
|
||||
CONFIG_FILE="$HOME/.runaway.conf"
|
||||
|
||||
load_config() {
|
||||
[ -f "$CONFIG_FILE" ] || return 0
|
||||
@@ -20,10 +20,10 @@ _rewrite_config() {
|
||||
local tmp
|
||||
[ -f "$CONFIG_FILE" ] || touch "$CONFIG_FILE"
|
||||
tmp=$(mktemp "${CONFIG_FILE}.XXXXXX") || return 1
|
||||
if ! UNLEASH_CONFIG_KEY="$key" UNLEASH_CONFIG_VALUE="$value" \
|
||||
UNLEASH_CONFIG_OPERATION="${3:-set}" awk '
|
||||
BEGIN { key=ENVIRON["UNLEASH_CONFIG_KEY"]; value=ENVIRON["UNLEASH_CONFIG_VALUE"];
|
||||
operation=ENVIRON["UNLEASH_CONFIG_OPERATION"] }
|
||||
if ! RUNAWAY_CONFIG_KEY="$key" RUNAWAY_CONFIG_VALUE="$value" \
|
||||
RUNAWAY_CONFIG_OPERATION="${3:-set}" awk '
|
||||
BEGIN { key=ENVIRON["RUNAWAY_CONFIG_KEY"]; value=ENVIRON["RUNAWAY_CONFIG_VALUE"];
|
||||
operation=ENVIRON["RUNAWAY_CONFIG_OPERATION"] }
|
||||
index($0, key "=")==1 { if (!found++ && operation=="set") print key "=" value; next }
|
||||
{ print }
|
||||
END { if (!found && operation=="set") print key "=" value }
|
||||
@@ -56,7 +56,7 @@ cmd_config() {
|
||||
local key="${3:-}"
|
||||
local value="${4:-}"
|
||||
[ -z "$key" ] || [ -z "$value" ] && {
|
||||
info "Usage: ./unleash config set KEY VALUE"
|
||||
info "Usage: ./runaway config set KEY VALUE"
|
||||
info "Keys: WEBHOOK, LOG_LEVEL (verbose), LOG_FILE"
|
||||
return 1
|
||||
}
|
||||
@@ -64,14 +64,14 @@ cmd_config() {
|
||||
;;
|
||||
unset)
|
||||
local key="${3:-}"
|
||||
[ -z "$key" ] && { info "Usage: ./unleash config unset KEY"; return 1; }
|
||||
[ -z "$key" ] && { info "Usage: ./runaway config unset KEY"; return 1; }
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
_rewrite_config "$key" "" unset || return 1
|
||||
success "Removed $key from config"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
info "Usage: ./unleash config {show|set KEY VALUE|unset KEY}"
|
||||
info "Usage: ./runaway config {show|set KEY VALUE|unset KEY}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user