Better uninstall support, help completions, etc.

* #293, #294
This commit is contained in:
Jorge Bucaran 2016-05-27 01:41:26 +09:00
parent 08158f2b84
commit 3f79861722
No known key found for this signature in database
GPG Key ID: E54BA3C0E646DB30
2 changed files with 21 additions and 43 deletions

View File

@ -29,7 +29,7 @@ Translations: [日本語], [简体中文], [한국어], [Русский], [Portu
Manually
```sh
curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisherman
curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisher
```
With brew
@ -72,7 +72,7 @@ $EDITOR ~/.config/fish/fishfile
fisher
```
Show what you've installed.
Show everything you've installed.
```ApacheConf
fisher ls
@ -123,10 +123,11 @@ fisher help z
## FAQ
### What is the required fish version?
[2.3.0]: https://github.com/fish-shell/fish-shell/releases/tag/2.3.0
\>=2.2.0.
For [snippet](#what-is-a-plugin) support, upgrade to >=2.3.0 or append the following code to your ~/.config/fish/config.fish.
For [snippet](#what-is-a-plugin) support, upgrade to >=[2.3.0] or append the following code to your ~/.config/fish/config.fish.
```fish
for file in ~/.config/fish/conf.d/*.fish
@ -138,17 +139,11 @@ end
Yes.
### Where does fisherman put stuff?
The cache and configuration go in ~/.cache/fisherman and ~/.config/fisherman respectively.
The fishfile is saved to ~/.config/fish/fishfile.
### What is a fishfile and how do I use it?
The fishfile ~/.config/fish/fishfile lists what plugins you've installed.
This file is updated automatically as you use fisherman to install and remove plugins. You can also edit this file and run `fisher` to commit changes.
This file is updated automatically as you install / remove plugins. You can also edit this file and run `fisher` to commit changes.
This mechanism only installs plugins and missing dependencies. To remove plugins, use `fisher rm`.

View File

@ -88,18 +88,8 @@ function $fisher_cmd_name -d "fish plugin manager"
return
end
if not command mkdir -p "$fish_config/"{conf.d,functions,completions} "$fisher_config" "$fisher_cache"
__fisher_log error "
I couldn't create the fisherman configuration.
You need write permissions in these directories:
$fish_config
$fisher_config
$fisher_cache
" > /dev/stderr
return 1
end
command mkdir -p "$fish_config/"{conf.d,functions,completions} "$fisher_config" "$fisher_cache"
or return 1
set -l completions "$fish_config/completions/$fisher_cmd_name.fish"
@ -576,7 +566,6 @@ function __fisher_plugin_url_clone_async -a url name branch
set -l nc (set_color normal)
set -l error (set_color $fish_color_error)
set -l okay (set_color $fish_color_match)
set -l hm_url (printf "%s\n" "$url" | command sed 's|^https://||')
if test ! -z "$branch"
@ -815,12 +804,18 @@ end
function __fisher_plugin_disable -a path
set -l plugin_name (basename $path)
for i in "$path/functions/uninstall.fish" "$path/uninstall.fish"
if test -s "$i"
builtin source "$i" ^ /dev/null
break
end
end
for file in $path/{functions/*,}*.fish
set -l name (basename "$file" .fish)
set -l base "$name.fish"
if test "$base" = "uninstall.fish"
builtin source "$file" ^ /dev/null
continue
end
@ -938,10 +933,6 @@ function __fisher_remove
for i in $orphans
__fisher_remove "$i" > /dev/stderr
end
for i in $removed
__fisher_log info "Remove &$i&" "$__fisher_stderr"
end
end
@ -1913,8 +1904,8 @@ function __fisher_complete
if test ! -s "$fisher_cache/.index"
if test ! -z "$config"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove" -a "$config"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove" -a "$fisher_active_prompt" -d "Prompt"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove h help" -a "$config"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove h help" -a "$fisher_active_prompt" -d "Prompt"
end
return
end
@ -1925,7 +1916,7 @@ function __fisher_complete
set -l path (command readlink "$name")
set -l name (command basename "$name" | sed "s|$real_home|~|")
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove" -a "$name" -d "$path"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove h help" -a "$name" -d "$path"
end
set -l IFS \t
@ -1946,7 +1937,7 @@ function __fisher_complete
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from info ls-remote" -a "$name" -d "$info"
if contains -- "$name" $config
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove" -a "$name" -d "$info"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove h help" -a "$name" -d "$info"
else
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from i in install" -a "$name" -d "$info"
end
@ -1958,7 +1949,7 @@ function __fisher_complete
case fisherman\*
case \*
set -l name (__fisher_plugin_get_names "$i")[1]
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove" -a "$name" -d "$i"
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from l ls list u up update r rm remove h help" -a "$name" -d "$i"
end
end
end
@ -1966,7 +1957,7 @@ end
function __fisher_humanize_duration
awk '
command awk '
function hmTime(time, stamp) {
split("h:m:s:ms", units, ":")
@ -1992,12 +1983,9 @@ end
function __fisher_get_key
stty -icanon -echo ^ /dev/null
printf "$argv" > /dev/stderr
while true
dd bs=1 count=1 ^ /dev/null | read -p "" -l yn
switch "$yn"
case y Y n N
printf "\n" > /dev/stderr
@ -2005,7 +1993,6 @@ function __fisher_get_key
break
end
end
stty icanon echo > /dev/stderr ^ /dev/null
end
@ -2029,7 +2016,6 @@ switch (command uname)
if test -z "$elapsed"
set elapsed 0
end
math (command date "+%s%3N") - $elapsed
end
end
@ -2038,13 +2024,11 @@ end
function __fisher_parse_column_output
command awk -v FS=\t '
{
for (i = 1; i <= NF; i++) {
if ($i != "") {
print $i
}
}
}
'
end
@ -2070,7 +2054,7 @@ function __fisher_usage
echo " "$u"i"$nc"nstall (default)"
echo " "$u"u"$nc"pdate"
echo " "$u"r"$nc"m"
echo " "$u"l"$nc"s (or ls-remote [--format FMT])"
echo " "$u"l"$nc"s (or ls-remote [--format=FORMAT])"
echo " "$u"h"$nc"elp"
end
@ -2097,7 +2081,6 @@ function __fisher_help -a cmd number
end
man -P "$pager" -- "$page"
command rm -f "$page"
else