diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index cf54713bd..1991ced1b 100755 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -72,25 +72,28 @@ wd_print_msg() wd_print_usage() { cat <<- EOF -Usage: wd [command] +Usage: wd [command] [point] Commands: - add Adds the current working directory to your warp points - add! Overwrites existing warp point - rm Removes the given warp point - show Print warp points to current directory - show Print path to given warp point - list Print all stored warp points -ls Show files from given warp point -path Show the path to given warp point - clean! Remove points warping to nonexistent directories + add Adds the current working directory to your warp points + add Adds the current working directory to your warp points with current directory's name + add! Overwrites existing warp point + add! Overwrites existing warp point with current directory's name + rm Removes the given warp point + rm Removes the given warp point with current directory's name + show Print path to given warp point + show Print warp points to current directory + list Print all stored warp points + ls Show files from given warp point (ls) + path Show the path to given warp point (pwd) + clean! Remove points warping to nonexistent directories - -v | --version Print version - -d | --debug Exit after execution with exit codes (for testing) - -c | --config Specify config file (default ~/.warprc) - -q | --quiet Suppress all output + -v | --version Print version + -d | --debug Exit after execution with exit codes (for testing) + -c | --config Specify config file (default ~/.warprc) + -q | --quiet Suppress all output - help Show this extremely helpful text + help Show this extremely helpful text EOF } @@ -154,6 +157,11 @@ wd_add() local force=$1 local point=$2 + if [[ $point == "" ]] + then + point=$(basename $(pwd)) + fi + if [[ $point =~ "^[\.]+$" ]] then wd_exit_fail "Warp point cannot be just dots" @@ -163,9 +171,6 @@ wd_add() elif [[ $point == *:* ]] then wd_exit_fail "Warp point cannot contain colons" - elif [[ $point == "" ]] - then - wd_exit_fail "Warp point cannot be empty" elif [[ ${points[$2]} == "" ]] || $force then wd_remove $point > /dev/null @@ -183,7 +188,12 @@ wd_add() wd_remove() { - local point=$1 + local point=$2 + + if [[ $point == "" ]] + then + point=$(basename $(pwd)) + fi if [[ ${points[$point]} != "" ]] then