mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
gitignore plugin: switch API endpoint to gitignore.io CDN and update README
This commit is contained in:
parent
f27c134264
commit
034f491976
2 changed files with 7 additions and 9 deletions
|
|
@ -1,18 +1,16 @@
|
|||
# Allow overriding API endpoint
|
||||
: ${GITIGNORE_API_PRIMARY:="https://www.toptal.com/developers/gitignore/api"}
|
||||
: ${GITIGNORE_API_FALLBACK:="https://www.gitignore.io/api"}
|
||||
|
||||
# gitignore plugin for oh-my-zsh
|
||||
# Uses gitignore.io CDN endpoint
|
||||
function _gi_curl() {
|
||||
curl -sfL "$1/$2" || curl -sfL "$GITIGNORE_API_FALLBACK/$2"
|
||||
curl -sfL "https://www.gitignore.io/api/$1"
|
||||
}
|
||||
|
||||
function gi() {
|
||||
local query="${(j:,:)@}"
|
||||
_gi_curl "$GITIGNORE_API_PRIMARY" "$query" || return 1
|
||||
_gi_curl "$query" || return 1
|
||||
}
|
||||
|
||||
_gitignoreio_get_command_list() {
|
||||
_gi_curl "$GITIGNORE_API_PRIMARY" "list" | tr "," "\n"
|
||||
_gi_curl "list" | tr "," "\n"
|
||||
}
|
||||
|
||||
_gitignoreio () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue