summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2013-06-13 13:22:05 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2013-06-13 13:22:05 +0200
commit2e2573fbe07d8a1750ccdda7e0a146fef55fd50d (patch)
treef7f850af86071f6b9dbfc719ba8861f4751bc8b6 /bin
parente5a1db282189a6d2a5b54c2aa14d9250e5d6b48d (diff)
Add version flag, -V
Add a flag to print the package version: `-V`. This change also brings with it the libexec directory, so we can pull common code out.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mkrc11
-rwxr-xr-xbin/rcup10
2 files changed, 17 insertions, 4 deletions
diff --git a/bin/mkrc b/bin/mkrc
index a9eef9c..cf360bf 100755
--- a/bin/mkrc
+++ b/bin/mkrc
@@ -23,6 +23,8 @@ install_dotfile() {
cd $prior_wd
}
+. `dirname $0`/../libexec/rcm/rcm.sh
+
if [ $# -eq 0 ]; then
echo "Usage: dotfiles-add [-t tag] filename ..."
exit 1
@@ -30,16 +32,21 @@ fi
tag=
verbosity=0
-while getopts vqt: opt; do
+version=0
+while getopts Vvqt: opt; do
case "$opt" in
t) tag=$OPTARG;;
v) verbosity=$(($verbosity + 1));;
q) verbosity=$(($verbosity - 1));;
+ V) version=1
esac
done
shift $(($OPTIND-1))
-if [ $verbosity -ge 2 ]; then
+if [ $version -eq 1 ]; then
+ version mkrc
+ exit 0
+elif [ $verbosity -ge 2 ]; then
MV="$MV -v"
INSTALL="$INSTALL -vv"
elif [ $verbosity -eq 1 ]; then
diff --git a/bin/rcup b/bin/rcup
index d733ea0..0569997 100755
--- a/bin/rcup
+++ b/bin/rcup
@@ -137,16 +137,21 @@ metafile() {
handle_command_line() {
arg_tags=""
verbosity=0
- while getopts qvt: opt; do
+ version=0
+ while getopts Vqvt: opt; do
case "$opt" in
t) arg_tags="$arg_tags $OPTARG";;
v) verbosity=$(($verbosity + 1));;
q) verbosity=$(($verbosity - 1));;
+ V) version=1
esac
done
shift $(($OPTIND-1))
- if [ $verbosity -ge 2 ]; then
+ if [ $version -eq 1 ]; then
+ version rcup
+ exit 0
+ elif [ $verbosity -ge 2 ]; then
DEBUG=echo
VERBOSE=echo
PRINT=echo
@@ -175,6 +180,7 @@ if [ -e $HOME/.rcrc ]; then
. $HOME/.rcrc
fi
+. `dirname $0`/../libexec/rcm/rcm.sh
handle_command_line $*
cd $DOTFILES_DIR