aboutsummaryrefslogtreecommitdiff
path: root/g.sh
diff options
context:
space:
mode:
authorMiquel Sabaté <mikisabate@gmail.com>2014-02-16 17:34:43 +0100
committerMiquel Sabaté <mikisabate@gmail.com>2014-02-16 17:34:43 +0100
commit35c0df4330d4623e2c403bd7acade2013b0a7f3f (patch)
treeda25b6964ec49396f6b549e2a4d9d5dbe7554b6a /g.sh
parent41fa909309f7b02848823605f79378a74f0d343e (diff)
downloadg-35c0df4330d4623e2c403bd7acade2013b0a7f3f.tar.gz
g-35c0df4330d4623e2c403bd7acade2013b0a7f3f.zip
The third argument for the add command is now optional.
The current working directory will be used if the third argument was not given.
Diffstat (limited to 'g.sh')
-rw-r--r--g.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/g.sh b/g.sh
index 37d8dbe..5e2fe51 100644
--- a/g.sh
+++ b/g.sh
@@ -82,12 +82,16 @@ g() {
help
;;
add)
- if [ "$#" != "3" ]; then
- echo "usage: g add <name> <path>"
+ path=`pwd`
+ if [ "$#" != "2" ] && [ "$#" != "3" ]; then
+ echo "usage: g add <name> [path]"
return
fi
+ if [ "$#" == "3" ]; then
+ path=$3
+ fi
get_shortcuts
- gshortcuts[$2]=$3
+ gshortcuts[$2]=$path
save_shortcuts
;;
rm)