From 2b2452dda97c6967fee23f553d90e1440677067a Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sun, 8 Dec 2013 13:41:59 -0500 Subject: [PATCH] Default source argument for bash_completion is now full path name --- README.md | 4 ++-- bash_completion | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 75dfe8e..f29a6da 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ The `bash_completion` file contains Bash completion for custom commands and ## Setup Source the `bash_completion` file (e.g. place in `.bashrc` or in `/etc/bash_completion.d/` on Debian systems), with the path to the provided -shortmaps file as the only argument: +`shortmaps` file as the only argument: ``` -$ . bash_completion . +$ . bash_completion ./shortmaps ``` You may also add your own mappings to `~/.git-shortmaps`. diff --git a/bash_completion b/bash_completion index e69d3e5..0f64585 100644 --- a/bash_completion +++ b/bash_completion @@ -33,8 +33,7 @@ __git-short_shortmap () } # load shortmaps from cwd (or provided path) and home dir (if available) -__git_short_maps=$( cat ${1:-.}/shortmaps ~/.git-shortmaps 2>/dev/null ) - +__git_short_maps=$( cat ${1:-./shortmaps} ~/.git-shortmaps 2>/dev/null ) # register each shortmap IFS=$'\n' @@ -43,9 +42,9 @@ for line in $__git_short_maps; do set -- $line short=$1 + [ -z "$1" ] && continue __git-short_docomplete "$1" __git-short_shortmap shift 2 alias $short="$( sed 's/^:/git /' <<< "$@" )" done -