1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-10-31 23:11:13 +00:00

move gitignore template function to modules/git

This commit is contained in:
Haojia Che 2014-11-03 16:48:54 +08:00
parent a14b6e5c31
commit 72328d0eed
5 changed files with 51 additions and 1 deletions

View File

@ -237,6 +237,7 @@ Functions
- `git-stash-recover` recovers given dropped stashed states. - `git-stash-recover` recovers given dropped stashed states.
- `git-submodule-move` moves a submodule. - `git-submodule-move` moves a submodule.
- `git-submodule-remove` removes a submodule. - `git-submodule-remove` removes a submodule.
- `git-ignore-template` get gitignore template from [gitignore.io][9]
Theming Theming
------- -------
@ -332,3 +333,4 @@ Authors
[6]: https://github.com/sorin-ionescu/prezto/issues [6]: https://github.com/sorin-ionescu/prezto/issues
[7]: https://github.com/sorin-ionescu/prezto/issues/219 [7]: https://github.com/sorin-ionescu/prezto/issues/219
[8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html [8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html
[9]: https://gitignore.io/

View File

@ -179,3 +179,6 @@ alias gwc='git clean -n'
alias gwC='git clean -f' alias gwC='git clean -f'
alias gwx='git rm -r' alias gwx='git rm -r'
alias gwX='git rm -rf' alias gwX='git rm -rf'
# Ignore list (ig)
alias gig='git-ignore-template'

View File

@ -0,0 +1,26 @@
#compdef _gitignireio git-ignore-template
#autoload
#
# Completes git-ignore-template
#
# Authors:
# Haojia Che <haojia.che@gmail.com>
#
typeset -A opt_args
_arguments -C \
'1::ignore:->ignores' \
&& ret=0
list=(`git-ignore-template`)
case "$state" in
(ignores)
languages=(`echo $list| tr "," "\n"`)
_describe 'templates' languages && ret=0
;;
esac;
return 1;

View File

@ -0,0 +1,20 @@
#
# Get ignore template from https://gitignore.io.
#
# Authors:
# Haojia Che <haojia.che@gmail.com>
#
# Use `git-ignore-template` or `git-ignore-template list` to get the list
# Uset `git-ignore-template <template name>` to get the template
#
# Example:
# `git-ignore-template java` to get a gitignore template for java.
#
function git-ignore-template() {
if [ $@ ]; then
curl -L -s https://www.gitignore.io/api/$@;
else
curl -L -s https://www.gitignore.io/api/list;
fi
}

View File

@ -1 +0,0 @@
function gi() { curl http://www.gitignore.io/api/$@ ;}