tAdded an option to delete a config file - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit e84a45be3e6a6b1516fda31ef60d0e68bc87f887
(DIR) parent 7a7368cc872cb5c35cac412eea554435ae111e16
(HTM) Author: z3bra <willy@mailoo.org>
Date: Wed, 7 May 2014 11:52:32 +0200
Added an option to delete a config file
Diffstat:
M hmgr | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/hmgr b/hmgr
t@@ -20,16 +20,20 @@ color_dirs='0;33' # colors for directory names
usage() {
-echo "usage: $(basename $0) [-uh] [-l [dir]] [-ni <file>] [-csr <dir>]"
+echo "usage: $(basename $0) [-hu] [-l [dir]] [-din <file>] [-csr <dir>]"
test -z "$1" && return
cat <<EOF
-h : help
-u : shortcut for -n ${USER}.h
- -n <name> : deal with file as <name> (defaults to config.def.h)
- -i <file> : input file to use (defaults to ./config.h)
+
-l [dir] : list currently managed applications/files
+
+ -d <dir>/<name> : remove <name> from managed configs
+ -i <file> : input file to use (defaults to ./config.h)
+ -n <name> : deal with file as <name> (defaults to config.def.h)
+
-c <dir> : check which config is in use
-s <dir> : store \`config.h\` to <dir>
-r <dir> : restore \`config.h\` from <dir>
t@@ -95,7 +99,7 @@ LS_COLORS="di=${color_dirs}:*.h=${color_conf}"
export LS_COLORS
# Parse options
-while getopts "chi:ln:s:r:u" opt; do
+while getopts "chi:ld:n:s:r:u" opt; do
case $opt in
# Check which config is in use
c) check;;
t@@ -104,6 +108,9 @@ while getopts "chi:ln:s:r:u" opt; do
u) cout=${usercfg};;
n) cout=${OPTARG};;
+ # Wipe the config given as argument
+ d) rm ${basedir}/$OPTARG;;
+
# Change the input file
i) cin=$OPTARG;;