Skip to content

Instantly share code, notes, and snippets.

@colstrom
Last active December 9, 2016 20:38
Show Gist options
  • Select an option

  • Save colstrom/4718a572833ca1e8a73ef7ed27635b14 to your computer and use it in GitHub Desktop.

Select an option

Save colstrom/4718a572833ca1e8a73ef7ed27635b14 to your computer and use it in GitHub Desktop.
gistpkg-fetch.fish: fetches a gistpkg from the internets
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
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