From 03427e4f97931c30793d21d7a272b862467be180 Mon Sep 17 00:00:00 2001 From: xyz Date: Sun, 17 Oct 2021 16:43:01 -0700 Subject: refactor --- home/xyz/.local/bin/cfg | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'home/xyz/.local/bin/cfg') 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 -- cgit v1.2.3-70-g09d2