1
0
Fork 0

Default source argument for bash_completion is now full path name

master
Mike Gerwitz 2013-12-08 13:41:59 -05:00
parent fadd65b69b
commit 2b2452dda9
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 4 additions and 5 deletions

View File

@ -8,10 +8,10 @@ The `bash_completion` file contains Bash completion for custom commands and
## Setup ## Setup
Source the `bash_completion` file (e.g. place in `.bashrc` or in 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 `/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`. You may also add your own mappings to `~/.git-shortmaps`.

View File

@ -33,8 +33,7 @@ __git-short_shortmap ()
} }
# load shortmaps from cwd (or provided path) and home dir (if available) # 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 # register each shortmap
IFS=$'\n' IFS=$'\n'
@ -43,9 +42,9 @@ for line in $__git_short_maps; do
set -- $line set -- $line
short=$1 short=$1
[ -z "$1" ] && continue
__git-short_docomplete "$1" __git-short_shortmap __git-short_docomplete "$1" __git-short_shortmap
shift 2 shift 2
alias $short="$( sed 's/^:/git /' <<< "$@" )" alias $short="$( sed 's/^:/git /' <<< "$@" )"
done done