diff options
author | xyz <gky44px1999@gmail.com> | 2021-10-17 16:43:01 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-10-17 16:43:01 -0700 |
commit | 03427e4f97931c30793d21d7a272b862467be180 (patch) | |
tree | 277192dae2af7102b281a1d3d6736a470a0671bd /home/xyz/.local/bin/cfg | |
parent | 2b1cfecf1440a34af5ef0acd266bbf0fa11a6d74 (diff) |
refactor
Diffstat (limited to 'home/xyz/.local/bin/cfg')
-rwxr-xr-x | home/xyz/.local/bin/cfg | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/home/xyz/.local/bin/cfg b/home/xyz/.local/bin/cfg index 796a4ddb..ea059322 100755 --- a/home/xyz/.local/bin/cfg +++ b/home/xyz/.local/bin/cfg @@ -1,17 +1,16 @@ #!/bin/sh -# didn't consider $HOME contain space? need improve? while getopts clsmM opt; do case $opt in c) dir="$HOME" cmd="git --git-dir=$dir/.cfg$opt/ --work-tree=$dir" - mods="$XDG_CONFIG_HOME/myconf/cfg${opt}_meta";; + meta_file="$XDG_CONFIG_HOME/myconf/cfg${opt}_meta";; l|s) dir=/ cmd="sudo git --git-dir=/etc/.cfg$opt/ --work-tree=/" - mods="/etc/myconf/cfg${opt}_meta";; - m) sudo gitmetap "$cmd" "$dir" "$mods" + meta_file="/etc/myconf/cfg${opt}_meta";; + m) sudo gitmetap "$cmd" "$dir" "$meta_file" exit;; - M) sudo gitmetar "$mods" + M) sudo gitmetar "$meta_file" exit;; \?) exit 1;; esac |