mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-02 03:59:25 +00:00
move gitignore template function to modules/git
This commit is contained in:
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
|
||||
}
|
Reference in New Issue
Block a user