feat(gitignore): use cdn as endpoint (#13497)
parent
233e81db4e
commit
e076690551
2 changed files with 15 additions and 6 deletions
@ -1,12 +1,21 @@ |
|||||||
function gi() { curl -fLw '\n' https://www.toptal.com/developers/gitignore/api/"${(j:,:)@}" } |
# gitignore plugin for oh-my-zsh |
||||||
|
# Uses gitignore.io CDN endpoint |
||||||
|
function _gi_curl() { |
||||||
|
curl -sfL "https://www.gitignore.io/api/$1" |
||||||
|
} |
||||||
|
|
||||||
|
function gi() { |
||||||
|
local query="${(j:,:)@}" |
||||||
|
_gi_curl "$query" || return 1 |
||||||
|
} |
||||||
|
|
||||||
_gitignoreio_get_command_list() { |
_gitignoreio_get_command_list() { |
||||||
curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr "," "\n" |
_gi_curl "list" | tr "," "\n" |
||||||
} |
} |
||||||
|
|
||||||
_gitignoreio () { |
_gitignoreio () { |
||||||
compset -P '*,' |
compset -P '*,' |
||||||
compadd -S '' `_gitignoreio_get_command_list` |
compadd -S '' $(_gitignoreio_get_command_list) |
||||||
} |
} |
||||||
|
|
||||||
compdef _gitignoreio gi |
compdef _gitignoreio gi |
||||||
Loading…
Reference in new issue