fisher/functions/fisher.fish
Jorge Bucaran ee0338d5b0
Ahoy! Fisherman gets a super patch v0.3.1
This patch contains several amends for 0.3.0 and
other minor documentation corrections.  Major
documentation revision and rewrite.

fisher help shows fisher(1) by default now.

Fix a critical bug that was causing fisher uninstall
--force to remove not the symbolic link, but the
actual files. Closes #24

Rename orphan tag to custom for plugins installed
using a custom URL.

warning Remove fisher --link flag and create symbolic
links by default for local paths. The user does not
have to worry about symbolic links or whether the
copy is as symbolic link or not anymore. If the user
tries to install a local path, then the best thing
to do is to create a symbolic link. This also
eliminates the need to call update.

warning Remove fisher --cache and fisher --validate.
Now, that these options are separated into their own
function and they are intentionally private, there
is no need for them.
2016-01-10 16:13:46 +09:00

114 lines
2.7 KiB
Fish

function fisher -d "Fish Shell Plugin Manager"
if not set -q argv[1]
fisher --help
return 1
end
set -l option
set -l value
set -l quiet -E .
set -l alias
getopts $argv | while read -l 1 2
switch "$1"
case _
set option command
set value $2
break
case a alias
set option alias
set alias $alias $2
case h help
set option help
set value $value $2
case l list
set option list
case f file
set option file
set value $2
case V validate
set option validate
case name
set option translate
case v version
set option version
case q quiet
set quiet -q .
case \*
printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher --help >& 2
return 1
end
end
switch "$option"
case command
__fisher_alias | 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" >& 2
fisher --help >& 2 | head -n1 >& 2
return 1
end
set -e argv[1]
if not eval "fisher_$value" (printf "%s\n" "'"$argv"'")
return 1
end
case list
__fisher_list
case file
__fisher_file "$value"
case alias
__fisher_alias $alias
case version
sed 's/^/fisher version /;q' $fisher_home/VERSION
case help
if test -z "$value"
set value commands
end
printf "usage: fisher <command> [<options>] [--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