fisher/functions/fisher.fish
Jorge Bucaran 4cfd037cc0 Ahoy! an early v0.7.0 is here!
+ Add  the ability  to install plugins  from Gists.  You can
distribute a very simple,  one-single function plugin in the
form  of a  Gist. Your  users  can install  it using  fisher
install  url and  Fisherman will  query the  Gist using  the
GitHub API to get a list of  the Gist files and use the name
of the  first identified *.fish  file to name the  plugin in
your system.  Since there is no  formal way to name  a Gist,
and you may  prefer to keep the "description"  field for the
actual description  and not a name,  Fisherman supports only
one fish file per Gist. Closes #75.

+ Use command(1) when calling non-builtins. Thanks @daenney.
Closes #79.

+  Add  __fisher_plugin_can_enable  to detect  installing  a
prompt that is not the current one. Closes #78.

+  Remove  the ability  to  install  a  plugin in  a  parent
directory using ..  or ../ or even worse, ../../  as well as
other combinations  that navigate  to a parent  directory. I
find  the use  case odd  at  best, and  more dangerous  that
useful.  If you  want  to  install a  local  plugin use  the
full  path  or a  relative  path,  always top  down.  fisher
install  . or  fisher  install my/plugin  or fisher  install
/Users/$USER/path/to/plugin. Closes #81.
2016-02-11 09:40:03 +09:00

94 lines
2.5 KiB
Fish

function fisher -d "Fish Plugin Manager"
set -l value
set -l option help
getopts $argv | while read -l 1 2
switch "$1"
case _
set option command
set value $2
break
case h help
set option help
set value $value $2
case l list
set option list
set value $2
case v version
set option version
case \*
if test ! -z "$option"
continue
end
printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr
fisher --help > /dev/stderr
return 1
end
end
switch "$option"
case command
printf "%s\n" $fisher_alias | sed 's/[=,]/ /g' | while read -la alias
if set -q alias[2]
switch "$value"
case $alias[2..-1]
set value $alias[1]
break
end
end
end
if not functions -q "fisher_$value"
printf "fisher: '%s' is not a valid command\n" "$value" > /dev/stderr
fisher --help > /dev/stderr
return 1
end
if contains -- --help $argv
fisher help $value
return
end
set -e argv[1]
eval "fisher_$value" (printf "%s\n" "'"$argv"'")
case list
if not __fisher_list $value
return 1
end
case version
sed 's/^/fisher version /;q' $fisher_home/VERSION
case help
if test -z "$value"
set value commands
end
printf "usage: fisher <command> [<args>] [--list] [--version] [--help]\n\n"
switch commands
case $value
printf "Available Commands:\n"
fisher_help --commands=bare
echo
end
switch guides
case $value
printf "Other Documentation:\n"
fisher_help --guides=bare
echo
end
printf "Use 'fisher help -g' to list guides and other documentation.\n"
printf "See 'fisher help <command or concept>' to access a man page.\n"
end
end