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:
parent
a14b6e5c31
commit
72328d0eed
@ -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/
|
||||||
|
@ -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'
|
||||||
|
26
modules/git/functions/_git-ignore-template
Normal file
26
modules/git/functions/_git-ignore-template
Normal 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;
|
20
modules/git/functions/git-ignore-template
Normal file
20
modules/git/functions/git-ignore-template
Normal 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
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
function gi() { curl http://www.gitignore.io/api/$@ ;}
|
|
Loading…
Reference in New Issue
Block a user