summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin/cfg
diff options
context:
space:
mode:
Diffstat (limited to 'home/xyz/.local/bin/cfg')
-rwxr-xr-xhome/xyz/.local/bin/cfg27
1 files changed, 27 insertions, 0 deletions
diff --git a/home/xyz/.local/bin/cfg b/home/xyz/.local/bin/cfg
new file mode 100755
index 00000000..299c6db9
--- /dev/null
+++ b/home/xyz/.local/bin/cfg
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+while getopts clsmM opt; do
+ case $opt in
+ c)
+ work_tree_dir="$HOME"
+ meta_file="$XDG_CONFIG_HOME/myconf/cfg${opt}_meta"
+ cmd="git --git-dir=$HOME/.cfg$opt/ --work-tree=$HOME"
+ ;;
+ l|s)
+ work_tree_dir=/
+ meta_file="/etc/myconf/cfg${opt}_meta"
+ cmd="sudo git --git-dir=/etc/.cfg$opt/ --work-tree=/"
+ ;;
+ m)
+ sudo gitmetap "$cmd" "$work_tree_dir" "$meta_file"
+ exit
+ ;;
+ M)
+ sudo gitmetar "$meta_file"
+ exit
+ ;;
+ \?) exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+$cmd "$@"