Last active
December 9, 2016 20:38
-
-
Save colstrom/4718a572833ca1e8a73ef7ed27635b14 to your computer and use it in GitHub Desktop.
gistpkg-fetch.fish: fetches a gistpkg from the internets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gistpkg-fetch --argument remote | |
| switch (count $argv) | |
| case 0 | |
| echo 'usage: gistpkg-fetch <remote>' | |
| return 100 | |
| case '*' | |
| set local (gistpkg-config root)/(sanitize-git-remote-url $remote) | |
| if directory-in-git $local >/dev/null | |
| set origin (git -C $local remote get-url --push origin) | |
| if test $origin = $remote | |
| printf "%s is already installed\n" $remote | |
| return 0 | |
| end | |
| end | |
| git clone $remote $local | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name = gistpkg-fetch | |
| author = Chris Olstrom | |
| license = MIT | |
| provides = fish/functions/gistpkg-fetch | |
| requires | |
| command/git | |
| fish/builtin/case | |
| fish/builtin/count | |
| fish/builtin/echo | |
| fish/builtin/end | |
| fish/builtin/function | |
| fish/builtin/if | |
| fish/builtin/printf | |
| fish/builtin/return | |
| fish/builtin/set | |
| fish/builtin/switch | |
| fish/builtin/test | |
| fish/functions/directory-in-git | |
| fish/functions/gistpkg-config | |
| fish/functions/gistpkg-fetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment