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,6 +1,6 @@
|
||||||
# gitignore
|
# gitignore
|
||||||
|
|
||||||
This plugin enables you the use of [gitignore.io](https://www.toptal.com/developers/gitignore) from the command line. You need an active internet connection.
|
This plugin enables you to use [gitignore.io](https://www.gitignore.io) from the command line. You need an active internet connection to fetch templates. The plugin uses the gitignore.io CDN endpoint to simplify access and improve reliability.
|
||||||
|
|
||||||
To use it, add `gitignore` to the plugins array in your zshrc file:
|
To use it, add `gitignore` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
|
@ -14,4 +14,4 @@ plugins=(... gitignore)
|
||||||
|
|
||||||
* `gi [TEMPLATENAME]`: Show git-ignore output on the command line, e.g. `gi java` to exclude class and package files.
|
* `gi [TEMPLATENAME]`: Show git-ignore output on the command line, e.g. `gi java` to exclude class and package files.
|
||||||
|
|
||||||
* `gi [TEMPLATENAME] >> .gitignore`: Appending programming language settings to your projects .gitignore.
|
* `gi [TEMPLATENAME] >> .gitignore`: Append the template rules to your project's `.gitignore` file.
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,16 @@
|
||||||
# Allow overriding API endpoint
|
# gitignore plugin for oh-my-zsh
|
||||||
: ${GITIGNORE_API_PRIMARY:="https://www.toptal.com/developers/gitignore/api"}
|
# Uses gitignore.io CDN endpoint
|
||||||
: ${GITIGNORE_API_FALLBACK:="https://www.gitignore.io/api"}
|
|
||||||
|
|
||||||
function _gi_curl() {
|
function _gi_curl() {
|
||||||
curl -sfL "$1/$2" || curl -sfL "$GITIGNORE_API_FALLBACK/$2"
|
curl -sfL "https://www.gitignore.io/api/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function gi() {
|
function gi() {
|
||||||
local query="${(j:,:)@}"
|
local query="${(j:,:)@}"
|
||||||
_gi_curl "$GITIGNORE_API_PRIMARY" "$query" || return 1
|
_gi_curl "$query" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_gitignoreio_get_command_list() {
|
_gitignoreio_get_command_list() {
|
||||||
_gi_curl "$GITIGNORE_API_PRIMARY" "list" | tr "," "\n"
|
_gi_curl "list" | tr "," "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
_gitignoreio () {
|
_gitignoreio () {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue