Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save colstrom/ab5879f6f8a64973051b787f50a8f675 to your computer and use it in GitHub Desktop.
gistpkg-config.fish: gistpkg configuration
function gistpkg-config --argument key
set --local key (printf "%s" $key | string replace --all --regex '[[:punct:]]' _)
switch "$key"
case list
list root origin fish_functions keyring
case root
if set --query GISTPKG_ROOT
echo $GISTPKG_ROOT
else
echo $HOME/.gistpkg
end
case origin
if set --query GISTPKG_ORIGIN
echo $GISTPKG_ORIGIN
else
echo gist.github.com
end
case keyring
if set --query GISTPKG_KEYRING
echo $GISTPKG_KEYRING
else
echo (gistpkg-config root)/keyring.gpg
end
case fish_functions
if set --query GISTPKG_FISH_FUNCTIONS
echo $GISTPKG_FISH_FUNCTIONS
else
echo $HOME/.config/fish/functions
end
case all ''
for key in (gistpkg-config list)
printf "%s\t%s\n" GISTPKG_(upcase $key) (gistpkg-config $key)
end
case '*'
return 100
end
end
name = gistpkg-config
author = Chris Olstrom
license = MIT
provides = fish/functions/gistpkg-config
requires
fish/builtin/case
fish/builtin/echo
fish/builtin/else
fish/builtin/end
fish/builtin/for
fish/builtin/function
fish/builtin/if
fish/builtin/printf
fish/builtin/return
fish/builtin/set
fish/builtin/string
fish/builtin/switch
fish/functions/gistpkg-config
fish/functions/list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment