summaryrefslogtreecommitdiff
path: root/pbs-plumb-config
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-01 02:20:42 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-01 02:20:42 -0400
commitc1c7f3a2516b1101cae844e2506ef8aace5cca29 (patch)
treeec85341767969d108ff44a609aa5a63cbae29a47 /pbs-plumb-config
initial commit
Diffstat (limited to 'pbs-plumb-config')
-rwxr-xr-xpbs-plumb-config43
1 files changed, 43 insertions, 0 deletions
diff --git a/pbs-plumb-config b/pbs-plumb-config
new file mode 100755
index 0000000..f175742
--- /dev/null
+++ b/pbs-plumb-config
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+##
+# Usage: list FILE
+# stdout: A newline-separated list of settings in FILE
+##
+list() {
+ [[ $# != 1 ]] && { usage; return 1; }
+ local file=$1
+ git config --file "$file" -z --list | awk -vRS='\0' -vFS='\n' '{ print $1 }' && return $PIPESTATUS
+}
+
+##
+# Usage: get FILE SETTING
+# stdout: The raw value of SETTING in FILE; *not* terminated by a newline
+##
+get() {
+ [[ $# != 2 ]] && { usage; return 1; }
+ local file=$1
+ local setting=$2
+ git config --file "$file" -z --get "$setting"
+}
+
+main() {
+ [[ $# < 1 ]] && { usage; return 1; }
+ local cmd=$1
+ shift
+
+ local file="/home/luke/parabola/pbs2/pbs-utils/config" # XXX
+ case "$cmd" in
+ list)
+ list "$file" "$@"
+ return $?;;
+ get)
+ get "$file" "$@"
+ return $?;;
+ *)
+ usage
+ return 1;;
+ esac
+}
+
+main "$@"