mirror of
https://github.com/jorgebucaran/fisher
synced 2024-11-03 15:40:27 +00:00
2cbbb00dcb
* Deprecate fisher --list in favor of a new command fisher list. The behavior is roughly the same. See fisher help list for usage. tl;dr: Use list to query the local system / cache and search to query the index. * Teach fisher_plugin_walk about fish_postexec, fish_command_not_found and fish_preexec event emitters and erase them during uninstall if they were defined in a snippet. * Fisherman now recognizes the following aliases by default: i for install, u for update, l for list, s for search and h for help. * Large documentation rewrite. Better, simpler, more concise and more consistent. * Fisherman now detects if users have modified their fish prompt using fish_config and if so, uninstalls $fisher_prompt.
55 lines
1.6 KiB
Fish
55 lines
1.6 KiB
Fish
function __fisher_plugin_validate -a plugin
|
|
if set -q argv[2]
|
|
printf "%s\n" "$argv"
|
|
return 1
|
|
end
|
|
|
|
switch "$plugin"
|
|
case ..\*
|
|
printf "%s\n" "../"
|
|
return 1
|
|
|
|
case . ./\* /\*
|
|
if test ! -e "$plugin"
|
|
printf "%s\n" $plugin
|
|
return 1
|
|
end
|
|
|
|
set plugin (
|
|
switch "$plugin"
|
|
case /\*
|
|
printf "%s\n" $plugin
|
|
|
|
case \*
|
|
printf "$PWD/%s/%s" (dirname "$plugin") (basename "$plugin")
|
|
|
|
end | sed -E 's|[./]*$||; s|/([\./])/+|/|g'
|
|
)
|
|
|
|
printf "%s\n" $plugin
|
|
|
|
__fisher_plugin_validate (basename $plugin) > /dev/null
|
|
|
|
case \*
|
|
set -l id "[A-Za-z0-9._-]"
|
|
|
|
if not printf "%s\n" "$plugin" | grep -qE "^(($id+)[:/]*)*\$"
|
|
printf "%s\n" "$plugin"
|
|
return 1
|
|
end
|
|
|
|
printf "%s\n" "$plugin" \
|
|
| sed -E "
|
|
s|^gh[:/]+|https://github.com/|
|
|
s|^gl[:/]+|https://gitlab.com/|
|
|
s|^bb[:/]+|https://bitbucket.org/|
|
|
s|^omf[:/]+|https://github.com/oh-my-fish/|
|
|
s|^($id+)/($id+)\$|https://github.com/\1/\2|
|
|
s|^(gist\.github\.com.*)|https://\1|
|
|
s|^http(s?)[:/]*|http\1://|
|
|
s|https://github((.com)?/)?|https://github.com/|
|
|
s|/*(\.git/*)*\$||g" \
|
|
| tr "[A-Z]" "[a-z]"
|
|
end
|
|
end
|