mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
parent
08158f2b84
commit
3f79861722
2 changed files with 21 additions and 43 deletions
15
README.md
15
README.md
|
@ -29,7 +29,7 @@ Translations: [日本語], [简体中文], [한국어], [Русский], [Portu
|
||||||
Manually
|
Manually
|
||||||
|
|
||||||
```sh
|
```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
|
With brew
|
||||||
|
@ -72,7 +72,7 @@ $EDITOR ~/.config/fish/fishfile
|
||||||
fisher
|
fisher
|
||||||
```
|
```
|
||||||
|
|
||||||
Show what you've installed.
|
Show everything you've installed.
|
||||||
|
|
||||||
```ApacheConf
|
```ApacheConf
|
||||||
fisher ls
|
fisher ls
|
||||||
|
@ -123,10 +123,11 @@ fisher help z
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### What is the required fish version?
|
### What is the required fish version?
|
||||||
|
[2.3.0]: https://github.com/fish-shell/fish-shell/releases/tag/2.3.0
|
||||||
|
|
||||||
\>=2.2.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
|
```fish
|
||||||
for file in ~/.config/fish/conf.d/*.fish
|
for file in ~/.config/fish/conf.d/*.fish
|
||||||
|
@ -138,17 +139,11 @@ end
|
||||||
|
|
||||||
Yes.
|
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?
|
### What is a fishfile and how do I use it?
|
||||||
|
|
||||||
The fishfile ~/.config/fish/fishfile lists what plugins you've installed.
|
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`.
|
This mechanism only installs plugins and missing dependencies. To remove plugins, use `fisher rm`.
|
||||||
|
|
||||||
|
|
49
fisher.fish
49
fisher.fish
|
@ -88,18 +88,8 @@ function $fisher_cmd_name -d "fish plugin manager"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not command mkdir -p "$fish_config/"{conf.d,functions,completions} "$fisher_config" "$fisher_cache"
|
command mkdir -p "$fish_config/"{conf.d,functions,completions} "$fisher_config" "$fisher_cache"
|
||||||
__fisher_log error "
|
or return 1
|
||||||
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
|
|
||||||
|
|
||||||
set -l completions "$fish_config/completions/$fisher_cmd_name.fish"
|
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 nc (set_color normal)
|
||||||
set -l error (set_color $fish_color_error)
|
set -l error (set_color $fish_color_error)
|
||||||
set -l okay (set_color $fish_color_match)
|
set -l okay (set_color $fish_color_match)
|
||||||
|
|
||||||
set -l hm_url (printf "%s\n" "$url" | command sed 's|^https://||')
|
set -l hm_url (printf "%s\n" "$url" | command sed 's|^https://||')
|
||||||
|
|
||||||
if test ! -z "$branch"
|
if test ! -z "$branch"
|
||||||
|
@ -815,12 +804,18 @@ end
|
||||||
function __fisher_plugin_disable -a path
|
function __fisher_plugin_disable -a path
|
||||||
set -l plugin_name (basename $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
|
for file in $path/{functions/*,}*.fish
|
||||||
set -l name (basename "$file" .fish)
|
set -l name (basename "$file" .fish)
|
||||||
set -l base "$name.fish"
|
set -l base "$name.fish"
|
||||||
|
|
||||||
if test "$base" = "uninstall.fish"
|
if test "$base" = "uninstall.fish"
|
||||||
builtin source "$file" ^ /dev/null
|
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -938,10 +933,6 @@ function __fisher_remove
|
||||||
for i in $orphans
|
for i in $orphans
|
||||||
__fisher_remove "$i" > /dev/stderr
|
__fisher_remove "$i" > /dev/stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in $removed
|
|
||||||
__fisher_log info "Remove &$i&" "$__fisher_stderr"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1913,8 +1904,8 @@ function __fisher_complete
|
||||||
|
|
||||||
if test ! -s "$fisher_cache/.index"
|
if test ! -s "$fisher_cache/.index"
|
||||||
if test ! -z "$config"
|
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 h help" -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 "$fisher_active_prompt" -d "Prompt"
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -1925,7 +1916,7 @@ function __fisher_complete
|
||||||
set -l path (command readlink "$name")
|
set -l path (command readlink "$name")
|
||||||
set -l name (command basename "$name" | sed "s|$real_home|~|")
|
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
|
end
|
||||||
|
|
||||||
set -l IFS \t
|
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"
|
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from info ls-remote" -a "$name" -d "$info"
|
||||||
|
|
||||||
if contains -- "$name" $config
|
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
|
else
|
||||||
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from i in install" -a "$name" -d "$info"
|
complete -xc $fisher_cmd_name -n "__fish_seen_subcommand_from i in install" -a "$name" -d "$info"
|
||||||
end
|
end
|
||||||
|
@ -1958,7 +1949,7 @@ function __fisher_complete
|
||||||
case fisherman\*
|
case fisherman\*
|
||||||
case \*
|
case \*
|
||||||
set -l name (__fisher_plugin_get_names "$i")[1]
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -1966,7 +1957,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function __fisher_humanize_duration
|
function __fisher_humanize_duration
|
||||||
awk '
|
command awk '
|
||||||
function hmTime(time, stamp) {
|
function hmTime(time, stamp) {
|
||||||
split("h:m:s:ms", units, ":")
|
split("h:m:s:ms", units, ":")
|
||||||
|
|
||||||
|
@ -1992,12 +1983,9 @@ end
|
||||||
|
|
||||||
function __fisher_get_key
|
function __fisher_get_key
|
||||||
stty -icanon -echo ^ /dev/null
|
stty -icanon -echo ^ /dev/null
|
||||||
|
|
||||||
printf "$argv" > /dev/stderr
|
printf "$argv" > /dev/stderr
|
||||||
|
|
||||||
while true
|
while true
|
||||||
dd bs=1 count=1 ^ /dev/null | read -p "" -l yn
|
dd bs=1 count=1 ^ /dev/null | read -p "" -l yn
|
||||||
|
|
||||||
switch "$yn"
|
switch "$yn"
|
||||||
case y Y n N
|
case y Y n N
|
||||||
printf "\n" > /dev/stderr
|
printf "\n" > /dev/stderr
|
||||||
|
@ -2005,7 +1993,6 @@ function __fisher_get_key
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
stty icanon echo > /dev/stderr ^ /dev/null
|
stty icanon echo > /dev/stderr ^ /dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2029,7 +2016,6 @@ switch (command uname)
|
||||||
if test -z "$elapsed"
|
if test -z "$elapsed"
|
||||||
set elapsed 0
|
set elapsed 0
|
||||||
end
|
end
|
||||||
|
|
||||||
math (command date "+%s%3N") - $elapsed
|
math (command date "+%s%3N") - $elapsed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2038,13 +2024,11 @@ end
|
||||||
function __fisher_parse_column_output
|
function __fisher_parse_column_output
|
||||||
command awk -v FS=\t '
|
command awk -v FS=\t '
|
||||||
{
|
{
|
||||||
|
|
||||||
for (i = 1; i <= NF; i++) {
|
for (i = 1; i <= NF; i++) {
|
||||||
if ($i != "") {
|
if ($i != "") {
|
||||||
print $i
|
print $i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
end
|
end
|
||||||
|
@ -2070,7 +2054,7 @@ function __fisher_usage
|
||||||
echo " "$u"i"$nc"nstall (default)"
|
echo " "$u"i"$nc"nstall (default)"
|
||||||
echo " "$u"u"$nc"pdate"
|
echo " "$u"u"$nc"pdate"
|
||||||
echo " "$u"r"$nc"m"
|
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"
|
echo " "$u"h"$nc"elp"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2097,7 +2081,6 @@ function __fisher_help -a cmd number
|
||||||
end
|
end
|
||||||
|
|
||||||
man -P "$pager" -- "$page"
|
man -P "$pager" -- "$page"
|
||||||
|
|
||||||
command rm -f "$page"
|
command rm -f "$page"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue