Ahoy!! Fisherman 1.0.0

* 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.

* Rewrite documentation to be simpler and more consistent.

* Fisherman can install "functions" now. If you have created
  a function interactively, you can run fisher install name
  of the function and a directory will be created in
  $PWD/name of the function and installed as usual.

* Fisherman now detects if users have modified their fish
  prompt using fish_config and if so, uninstalls $fisher_prompt.

* Search results now truncate plugin descriptions based in
 the width of the terminal screen.

* Install/Update/Uninstall CLI was retouched.

Looking behind and Ahead
========================

On Jan, 1st, Fisherman 0.1.0 departed from the bay of
"my hard drive" and today 1.0.0 has finally shipped.

Things are still a little rough and knotty, what did
you think? But 1.0.0 means all the basic things are
here.

Internally, we may still push some large changes, more
robust tests; at ~300 there are still areas a bit dry.

On the outside, Fisherman will change little, I hope.
That's a feature. If you want a more colorful CLI,
concurrent updates, or another bit here and there,
we may work something out.

This release means more time to focus on the plugin
ecosystem, but the adventures are far from over.
This commit is contained in:
Jorge Bucaran 2016-03-01 17:36:20 +09:00
parent ebec1eaa01
commit 8384bf3aa7
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30
27 changed files with 262 additions and 181 deletions

View file

@ -10,10 +10,23 @@
* 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.
* Rewrite documentation to be simpler and more consistent.
* Fisherman can install "functions" now. If you have created a function interactively, you can run fisher install `name of the function` and a directory will be created in `$PWD/name of the function` and installed as usual.
![](https://cloud.githubusercontent.com/assets/8317250/13421665/14e73e12-dfd3-11e5-98a5-88b269ebddd7.gif)
* Fisherman now detects if users have modified their fish prompt using fish_config and if so, uninstalls $fisher_prompt.
* Search results now truncate plugin descriptions based in the width of the terminal screen.
![](https://cloud.githubusercontent.com/assets/8317250/13421733/8885c65e-dfd3-11e5-84f0-e70065b55f70.gif)
* Install/Update/Uninstall CLI was retouched.
![cli](https://cloud.githubusercontent.com/assets/8317250/13421788/d3d873c2-dfd3-11e5-9a74-24483d29b6ff.gif)
## [0.9.0][v090] - 2016-02-25
* Welcome aboard @jethrokuan, the newest Fisherman organization member.

View file

@ -21,21 +21,21 @@ curl -sL get.fisherman.sh | fish
**Fisherman** is a blazing fast, modern plugin manager for [fish].
&nbsp;&nbsp; **[Why?]**<br>
&nbsp;&nbsp; **[Quickstart]**<br>
&nbsp;&nbsp; **[Get Started]**<br>
&nbsp;&nbsp; **[Plugins]**<br>
&nbsp;&nbsp; **[Help]**<br>
[travis-link]: https://travis-ci.org/fisherman/fisherman
[travis-badge]: https://img.shields.io/travis/fisherman/fisherman.svg?style=flat-square
[version-badge]: https://img.shields.io/badge/latest-v0.9.0-00B9FF.svg?style=flat-square
[version-badge]: https://img.shields.io/badge/latest-v1.0.0-00B9FF.svg?style=flat-square
[version-link]: https://github.com/fisherman/fisherman/releases
[slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://img.shields.io/badge/slack-join%20the%20chat-00B9FF.svg?style=flat-square
[Why?]: https://github.com/fisherman/fisherman/issues/69#issuecomment-179661994
[Quickstart]: https://github.com/fisherman/fisherman/wiki/Quickstart-Guide
[Get Started]: https://github.com/fisherman/fisherman/wiki/Quickstart-Guide
[Plugins]: http://fisherman.sh/#search
[Help]: https://github.com/fisherman/fisherman/wiki

View file

@ -1 +1 @@
0.9.0
1.0.0

View file

@ -1,7 +1,7 @@
function __fisher_deps_install -a path
for file in $path/{fishfile,bundle}
if test -s $file
debug "Install dependencies %s" "$file"
debug "Install deps %s" "$file"
fisher_install < $file | sed -En 's/^.+([0-9]+) plugin\/s.*/\1/p'
end
end | awk '{ n = n + $0 } END { print n ? n : 0 }'

View file

@ -5,7 +5,7 @@ function __fisher_file
}
!/^[ \t]*(#.*)*$/ {
gsub("^[@*>]|#.*", "")
gsub("^[@*>]?[ \t]*?|#.*", "")
if (! seen[$1]++) {
printf("%s\n", $1)

View file

@ -6,7 +6,7 @@ function __fisher_file_remove -a plugin file
set pattern "/^$pattern\$/d"
end
debug "Fishfile remove %s" "$plugin"
debug "File remove %s" "$plugin"
sed -E "$pattern" < $file > $file.tmp

View file

@ -0,0 +1,12 @@
function __fisher_function_to_plugin -a name
if test -d "$name"
return 1
end
set -l path (pwd)/$name
mkdir -p "$path"
functions -- $name | fish_indent > "$path/$name.fish"
printf "%s\n" "$path"
end

View file

@ -1,10 +1,8 @@
function __fisher_gist_to_name -a url
set -l id (printf "%s\n" "$url" | sed 's|.*/||')
debug "Get Gist information '%s'" $url
set -l name (
spin "curl -Ss https://api.github.com/gists/$id" | awk '
spin "curl -Ss https://api.github.com/gists/$id" -f " @\r" | awk '
/"files": / { files++ }

View file

@ -8,6 +8,11 @@ function __fisher_index_update -a timeout
end
set -l url $fisher_index
if test ! -d $fisher_cache
mkdir -p $fisher_cache
end
set -l index $fisher_cache/.index.tmp
if test -z "$url"

View file

@ -12,7 +12,7 @@ function __fisher_key_bindings_enable -a plugin user_key_bindings
source $user_key_bindings
end
debug "Add fisherman key bindings '%s'" "$user_key_bindings"
debug "Bind %s" "$user_key_bindings"
functions fish_user_key_bindings \
| __fisher_key_bindings_update_user > $user_key_bindings

View file

@ -3,15 +3,14 @@ function __fisher_path_make -a path
return
end
debug "Makefile '%s'" "$path/Makefile"
debug "Make %s" "$path/Makefile"
pushd $path
set -e argv[1]
if not make $argv
debug "Make fail '%s'" "$argv"
debug "Make fail %s" "$argv"
popd
return 1
end

View file

@ -7,12 +7,12 @@ function __fisher_path_update -a path
return 1
end
git checkout master --quiet
git checkout master --quiet ^ /dev/null
git stash --quiet ^ /dev/null
if not git pull --rebase origin master --quiet ^ /dev/null
git rebase --abort
git rebase --abort --quiet
git fetch origin master --quiet
git reset --hard FETCH_HEAD --quiet
git clean -d --force --quiet

View file

@ -2,7 +2,7 @@ function __fisher_plugin_disable -a plugin path option
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target name
switch "$class"
case --bind
debug "Disable key bindings '%s'" $plugin
debug "Unbind %s" $plugin
__fisher_key_bindings_disable $plugin (__fisher_xdg --config
)/fish/functions/fish_user_key_bindings.fish
@ -20,7 +20,7 @@ function __fisher_plugin_disable -a plugin path option
end
if test -s $fisher_file
debug "Remove from fishfile %s" "$plugin"
debug "File remove %s" "$plugin"
__fisher_file_remove (
if not fisher_search --name=$plugin --name --index=$fisher_cache/.index

View file

@ -1,18 +1,9 @@
function __fisher_plugin_enable -a plugin path
debug "Plugin enable %s" "$plugin"
debug "Enable %s" "$plugin"
if __fisher_path_is_prompt $path
if test ! -z "$fisher_prompt"
debug "Disable current prompt to install '%s'" $plugin
# Why do we need to disable a prompt before installing another? I thought
# one prompt would override the other?
# While this is true for fish_prompt and fish_right_prompt, a prompt is no
# different from other plugins and may optionally include other functions,
# scripts, completions, documentation, etc., which need also be removed.
debug "Enable prompt %s" $plugin
__fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt"
end
@ -22,22 +13,13 @@ function __fisher_plugin_enable -a plugin path
set -l link -f
if test -L $path
# The path will be a soft link if the user tried to install a plugin from
# any directory in the local system, including plugins registered in the
# index. In this case we want to create soft links from <path> (which is
# also a soft link) as we walk the plugin's directory.
# The advantage of creating soft links from local projects is that it
# allows rapid prototyping / debugging of new or existing plugins.
set link -sfF
end
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target __unused
switch "$class"
case --bind
debug "Enable key bindings %s" $source
debug "Bind %s" $source
__fisher_key_bindings_enable $plugin (__fisher_xdg --config
)/fish/functions/fish_user_key_bindings.fish < $source
@ -64,12 +46,12 @@ function __fisher_plugin_enable -a plugin path
if test -s $fisher_file
if __fisher_file_contains "$item" --quiet $fisher_file
debug "Fishfile skip %s" "$item"
debug "File skip %s" "$item"
return
end
end
debug "Fishfile add %s" "$item"
debug "File add %s" "$item"
printf "%s\n" $item >> $fisher_file
end

View file

@ -1,5 +1,4 @@
function __fisher_plugin_link -a options source target
debug "Link '%s'" $target
debug "Link %s" $target
command ln $options $source $target
end

View file

@ -1,5 +1,4 @@
function __fisher_plugin_source -a plugin file
debug "Source '%s'" $file
debug "Source %s" $file
source "$file" ^ /dev/null
end

View file

@ -1,6 +1,4 @@
function __fisher_prompt_reset
debug "Reset prompt '%s'" "$fisher_prompt"
set -U fisher_prompt
# To reset the prompt, remove any data in fisher_prompt and source any existing
@ -12,7 +10,7 @@ function __fisher_prompt_reset
for prompt in $argv/functions/fish_prompt.fish
if test -s $prompt
debug "Default prompt '%s'" $prompt
debug "Reset prompt %s" $prompt
source $prompt
return

View file

@ -8,12 +8,8 @@ function fish_config -d "Launch fish's web based configuration" -a tab
set -l file $config/fish/functions/fish_prompt.fish
set -l sum_before (cksum $file ^ /dev/null | awk '{ print $1 + $2 }')
debug "fish_config start"
eval $__fish_datadir/tools/web_config/webconfig.py $tab
debug "fish_config end"
if test ! -z "$fisher_prompt"
set -l sum_after (cksum $file ^ /dev/null | awk '{ print $1 + $2 }')

View file

@ -31,9 +31,9 @@ function fisher_help -d "Show help"
case h
printf "Usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
printf " -a --all List all the documentation\n"
printf " -g --guides List available guides\n"
printf " -h --help Show usage help\n"
printf " -a --all List all the documentation\n"
printf " -g --guides List available guides\n"
printf " -h --help Show usage help\n"
return
case \*

View file

@ -12,15 +12,19 @@ function fisher_install -d "Install plugins"
case f force
set option force
if test ! -z "$2"
set plugins $plugins $2
end
case q quiet
set stdout /dev/null
set stderr /dev/null
case h
printf "Usage: fisher install [<plugins>] [--force] [--quiet] [--help]\n\n"
printf " -f --force Reinstall given plugin/s\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
printf " -f --force Reinstall given plugin/s\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
return
case \*
@ -36,6 +40,7 @@ function fisher_install -d "Install plugins"
set -l index 1
set -l total (count $plugins)
set -l skipped
set -l indicator "▸"
set -l IFS \t
@ -53,11 +58,11 @@ function fisher_install -d "Install plugins"
continue
end
debug "Validate pass %s" $item
debug "Validate ok %s" $item
switch "$item"
case https://gist.github.com\*
debug "Install gist %s" $item
debug "Gist %s" $item
if set -l name (__fisher_gist_to_name $item)
printf "%s\t%s\n" $item $name
@ -67,29 +72,44 @@ function fisher_install -d "Install plugins"
end
case \*/\*
debug "Install URL %s" $item
debug "URL or path %s" $item
printf "%s\t%s\n" "$item" (printf "%s\n" "$item" | __fisher_name)
case \*
if set -l url (fisher_search --url --name=$item --index=$fisher_cache/.index)
debug "Install %s" $item
printf "%s\t%s\n" $url $item
else if test -d $fisher_cache/$item
debug "Install %s" \$fisher_cache/$item
if test -d $fisher_cache/$item
debug "Cache %s" \$fisher_cache/$item
printf "%s\t%s\n" (__fisher_url_from_path $fisher_cache/$item) $item
else
set total (math $total - 1)
printf "fisher: '%s' not found or index out of date.\n" $item > $stderr
if functions -q "$item"
if set -l path (__fisher_function_to_plugin $item)
printf "%s\t%s" "$path" $item
continue
end
end
if test ! -s $fisher_cache/.index
printf "$indicator Updating Index %s\n" $name > $stderr
if spin "__fisher_index_update" --error=/dev/null -f " @\r" > /dev/null
debug "Update index ok"
else
debug "Update index fail"
end
end
if set -l url (fisher_search --url --name=$item --index=$fisher_cache/.index)
debug "Index %s" $item
printf "%s\t%s\n" $url $item
else
set total (math $total - 1)
printf "fisher: '%s' not found or index out of date.\n" $item > $stderr
end
end
end
end | while read -l url name
if contains -- $name (fisher_list $fisher_file)
if test -z "$option"
set total (math $total - 1)
@ -98,14 +118,14 @@ function fisher_install -d "Install plugins"
end
end
printf "Installing " > $stderr
printf "$indicator Installing " > $stderr
switch $total
case 0 1
printf ">> %s\n" $name > $stderr
printf "%s\n" $name > $stderr
case \*
printf "(%s of %s) >> %s\n" $index $total $name > $stderr
printf "(%s of %s) %s\n" $index $total $name > $stderr
set index (math $index + 1)
end
@ -119,9 +139,9 @@ function fisher_install -d "Install plugins"
command ln -sfF $url $path
else
debug "Download %s" $url
debug "Clone %s" $url
if not spin "__fisher_url_clone $url $path" --error=$stderr
if not spin "__fisher_url_clone $url $path" --error=$stderr -f " @\r"
continue
end
end
@ -130,7 +150,7 @@ function fisher_install -d "Install plugins"
set -l deps (__fisher_deps_install "$path")
if test "$deps" -gt 0
debug "Install dependencies success"
debug "Install deps ok"
end
if not __fisher_path_make "$path" --quiet
@ -146,9 +166,8 @@ function fisher_install -d "Install plugins"
set time (math (date +%s) - $time)
if test ! -z "$skipped"
printf "%s plugin/s skipped (%s)\n" (count $skipped) (
printf "%s\n" $skipped | paste -sd ' ' -
) > $stdout
printf "%s plugin/s skipped (%s)\n" (
count $skipped) (printf "%s\n" $skipped | paste -sd ' ' -) > $stdout
end
if test "$count" -le 0
@ -156,12 +175,12 @@ function fisher_install -d "Install plugins"
return 1
end
debug "Pre-reset completions and key bindings"
debug "Reset completions and key bindings start"
__fisher_complete_reset
__fisher_key_bindings_reset
debug "Post-reset completions and key bindings"
debug "Reset completions and key bindings ok"
printf "Aye! %d plugin/s installed in %0.fs\n" $count $time > $stdout
printf "%d plugin/s installed in %0.fs\n" $count $time > $stdout
end

View file

@ -54,11 +54,11 @@ function fisher_list -a key -d "List installed plugins"
case -h
printf "Usage: fisher list [<file>] [--enabled] [--disabled] [--bare] [--link] \n\n"
printf " -b --bare List plugin without decorators\n"
printf " -l --link List plugins that are symbolic links\n"
printf " --enabled List plugins that are enabled\n"
printf " --disabled List plugins that are disabled\n"
printf " -h --help Show usage help\n"
printf " -b --bare List plugin without decorators\n"
printf " -l --link List plugins that are symbolic links\n"
printf " --enabled List plugins that are enabled\n"
printf " --disabled List plugins that are disabled\n"
printf " -h --help Show usage help\n"
return
case \*

View file

@ -47,7 +47,7 @@ function fisher_search -d "Search plugin index"
set query $query "$3 tags(\"$2\")" $join
end
case long
case long longline
set format long
case full
@ -75,11 +75,11 @@ function fisher_search -d "Search plugin index"
printf "Usage: fisher search [<plugins>] [--long] [--full] [--no-color]\n"
printf " [--quiet] [--help]\n\n"
printf " --long Display results in long format\n"
printf " --full Display results in full format\n"
printf " -C --no-color Turn off color display\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
printf " --long Display results in long format\n"
printf " --full Display results in full format\n"
printf " -C --no-color Turn off color display\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
return
case \*
@ -101,9 +101,8 @@ function fisher_search -d "Search plugin index"
if test $fisher_last_update -gt $fisher_update_interval -o ! -f $index
debug "Update index start"
if spin "__fisher_index_update" --error=/dev/null
debug "Update index success"
if spin "__fisher_index_update" --error=/dev/null -f " @\r" > /dev/null
debug "Update index ok"
__fisher_complete_reset
else
debug "Update index fail"
@ -129,25 +128,24 @@ function fisher_search -d "Search plugin index"
end
end
set -l name_color (set_color $fish_color_command)
set -l url_color (set_color $fish_color_cwd -u)
set -l tag_color (set_color $fish_color_cwd)
set -l weak_color (set_color white)
set -l author_color (set_color -u)
set -l normal (set_color $fish_color_normal)
set -l color_name (set_color $fish_color_command)
set -l color_url (set_color $fish_color_cwd -u)
set -l color_tag (set_color $fish_color_cwd)
set -l color_weak (set_color white)
set -l color_author (set_color -u)
set -l color_normal (set_color $fish_color_normal)
if contains -- no-color $option
set name_color
set url_color
set tag_color
set weak_color
set author_color
set normal
set color_name
set color_url
set color_tag
set color_weak
set color_author
set color_normal
end
set legend
set local (fisher_list | awk '
!/^@/ {
if (append) {
printf("|")
@ -166,6 +164,7 @@ function fisher_search -d "Search plugin index"
set fields '
legend="*"
len = length($3)
if ($1 == "'"$fisher_prompt"'") {
legend = ">"
@ -177,27 +176,27 @@ function fisher_search -d "Search plugin index"
switch "$format"
case default
set fields $fields '
printf("%s '"$weak_color"'%-18s'"$normal"' %s\n", legend, $1, $3)
printf("%s '"$color_weak"'%-18s'"$color_normal"' %s\n", legend, $1, normalize($3, len + 24))
} else {
printf("'"$legend$name_color"'%-18s'"$normal"' %s\n", $1, $3)
printf("'"$legend$color_name"'%-18s'"$color_normal"' %s\n", $1, normalize($3, len + 24))
}
'
set options $options -v compact=1
case long
set fields $fields '
printf("%-40s %s '"$weak_color"'%-18s'"$normal"' %s\n", humanize_url($2), legend, $1, $3)
printf("%-40s %s '"$color_weak"'%-18s'"$color_normal"' %s\n", humanize_url($2), legend, $1, normalize($3, len + 66))
} else {
printf("'"$tag_color"'%-40s'"$normal"' '"$legend$name_color"'%-18s'"$normal"' %s\n", humanize_url($2), $1, $3)
printf("'"$color_tag"'%-40s'"$color_normal"' '"$legend$color_name"'%-18s'"$color_normal"' %s\n", humanize_url($2), $1, normalize($3, len + 66))
}
'
set options $options -v compact=1
case full
set fields $fields '
printf("'"$weak_color"'%s %s by %s\n%s'"$normal"'\n%s\n", legend, $1, $5, $3, humanize_url($2))
printf("'"$color_weak"'%s %s by %s\n%s'"$color_normal"'\n%s\n", legend, $1, $5, $3, humanize_url($2))
} else {
printf("'"$name_color"'%s'"$normal"' by '"$author_color"'%s'"$normal"'\n%s\n'"$url_color"'%s'"$normal"'\n", $1, $5, $3, humanize_url($2))
printf("'"$color_name"'%s'"$color_normal"' by '"$color_author"'%s'"$color_normal"'\n%s\n'"$color_url"'%s'"$color_normal"'\n", $1, $5, $3, humanize_url($2))
}
'
end
@ -209,8 +208,19 @@ function fisher_search -d "Search plugin index"
set fields print $fields
end
set -l cols (tput cols)
awk -v FS='\n' -v RS='' $options "
function normalize(s, len) {
x = len - $cols
if (len >= $cols) {
return substr(s, 1, length(s) - x)\"...\"
} else {
return s
}
}
function humanize_url(url) {
gsub(\"(https?://)?(www.)?|/\$\", \"\", url)
return url
@ -251,8 +261,8 @@ function fisher_search -d "Search plugin index"
print \"\"
}
if (!shit[\$5] || !unique) {
shit[\$5] = 1
if (!unique_author[\$5] || !unique) {
unique_author[\$5] = 1
$fields
}

View file

@ -12,15 +12,19 @@ function fisher_uninstall -d "Uninstall plugins"
case f force
set option force
if test ! -z "$2"
set plugins $plugins $2
end
case q quiet
set stdout /dev/null
set stderr /dev/null
case h
printf "Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]\n\n"
printf " -f --force Delete copy from the cache\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
printf " -f --force Delete copy from the cache\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
return
case \*
@ -35,17 +39,17 @@ function fisher_uninstall -d "Uninstall plugins"
set -l index 1
set -l total (count $plugins)
set -l skipped
set -l indicator "▸"
set -l IFS \t
if set -q plugins[1]
printf "%s\n" $plugins
else
__fisher_file
end | while read -l item path
debug "Validate %s" $item
debug "Shit %s" $path
if not set item (__fisher_plugin_validate $item)
debug "Validate fail %s" $item
@ -53,7 +57,7 @@ function fisher_uninstall -d "Uninstall plugins"
continue
end
debug "Validate pass %s" $item
debug "Validate ok %s" $item
if not set path (__fisher_path_from_plugin $item)
set total (math $total - 1)
@ -73,26 +77,26 @@ function fisher_uninstall -d "Uninstall plugins"
end
end
printf "Uninstalling " > $stderr
printf "$indicator Uninstalling " > $stderr
switch $total
case 0 1
printf ">> %s\n" $name > $stderr
printf "%s\n" $name > $stderr
case \*
printf "(%s of %s) >> %s\n" $index $total $name > $stderr
printf "(%s of %s) %s\n" $index $total $name > $stderr
set index (math $index + 1)
end
if __fisher_plugin_can_enable "$name" "$path"
debug "Plugin disable %s w/ option %s" "$name" "$option"
debug "Disable %s[:%s]" "$name" "$option"
__fisher_plugin_disable "$name" "$path" "$option"
else
debug "Plugin can't dissable %s" "$name"
debug "Disable skip %s" "$name"
end
if test "$option" = force
debug "Remove path '%s'" "$path"
debug "Delete %s" "$path"
command rm -rf $path
end
@ -117,7 +121,7 @@ function fisher_uninstall -d "Uninstall plugins"
__fisher_complete_reset
__fisher_key_bindings_reset
debug "Reset completions and key bindings done"
debug "Reset completions and key bindings ok"
printf "Aye! %d plugin/s uninstalled in %0.fs\n" $count $time > $stdout
printf "%d plugin/s uninstalled in %0.fs\n" $count $time > $stdout
end

View file

@ -13,14 +13,18 @@ function fisher_update -d "Update plugins"
set plugins $plugins $2
end
case a all
set option all
case q quiet
set stdout /dev/null
set stderr /dev/null
case h
printf "Usage: fisher update [<plugins>] [--quiet] [--help]\n\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
printf "Usage: fisher update [<plugins>] [--all] [--quiet] [--help]\n\n"
printf " -a --all Update everything\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
return
case \*
@ -30,29 +34,37 @@ function fisher_update -d "Update plugins"
end
end
set -l indicator "▸"
switch "$option"
case all
fisher_list --enabled | fisher_update -
fisher_update
case self
set -l time (date +%s)
debug "Update Fisherman %s" $fisher_home
debug "Update Index %s" $fisher_index
debug "Update %s" $fisher_index
debug "Update %s" $fisher_home
printf "Updating >> Index\n" > $stderr
printf "$indicator Updating Index\n" > $stderr
if not spin "__fisher_index_update 0" --error=$stderr
if not spin "__fisher_index_update 0" --error=$stderr -f " @\r"
debug "Update Index fail"
printf "fisher: I could not update the index. Trying to update Fisherman...\n" > $stderr
printf "fisher: I could not update the index.\n" > $stderr
end
if not spin "__fisher_path_update $fisher_home" --error=$stderr
printf "$indicator Updating Fisherman\n" > $stderr
if not spin "__fisher_path_update $fisher_home" --error=$stderr -f " @\r"
debug "Update Fisherman fail"
printf "fisher: Sorry, but I couldn't update Fisherman.\n\n" > $stderr
return 1
end
debug "Update Fisherman success"
debug "Update Fisherman ok"
printf "Aye! Fisherman up to date with version %s (%0.fs)\n" (
cat $fisher_home/VERSION) (math (date +%s) - $time) > $stderr
@ -70,16 +82,19 @@ function fisher_update -d "Update plugins"
printf "%s\n" $plugins
else
__fisher_file
end | while read -l item path
debug "Validate '%s'" $item
debug "Validate %s" $item
if not set item (__fisher_plugin_validate $item)
debug "Validate fail %s" $item
printf "fisher: '%s' is not a valid name, path or URL.\n" $item > $stderr
continue
end
debug "Validate ok %s" $item
if not set path (__fisher_path_from_plugin $item)
set total (math $total - 1)
printf "fisher: '%s' not found.\n" $item > $stderr
@ -88,30 +103,30 @@ function fisher_update -d "Update plugins"
set -l name (printf "%s\n" $path | __fisher_name)
printf "Updating " > $stderr
printf "$indicator Updating " > $stderr
switch $total
case 0 1
printf ">> %s\n" $name > $stderr
printf "%s\n" $name > $stderr
case \*
printf "(%s of %s) >> %s\n" $index $total $name > $stderr
printf "(%s of %s) %s\n" $index $total $name > $stderr
set index (math $index + 1)
end
if test ! -L $path
debug "Update plugin '%s' start" "$name"
debug "Update start %s" "$name"
if not spin "__fisher_path_update $path" --error=$stderr
debug "Update path fail '%s'" "$path"
if not spin "__fisher_path_update $path" --error=$stderr -f " @\r"
debug "Update fail %s" "$path"
continue
end
end
debug "Update plugin success '%s'" "$name"
debug "Update ok %s" "$name"
if __fisher_plugin_can_enable "$name" "$path"
debug "Enable plugin '%s'" "$name"
debug "Enable %s" "$name"
fisher_install --quiet --force -- $name
end
@ -126,6 +141,6 @@ function fisher_update -d "Update plugins"
return 1
end
printf "Aye! %d plugin/s updated in %0.fs\n" $count $time > $stdout
printf "%d plugin/s updated in %0.fs\n" $count $time > $stdout
end
end

View file

@ -49,11 +49,11 @@ Fisherman knows the following aliases by default: \fIi\fR for install, \fIu\fR f
.SH "OPTIONS"
.
.TP
\fB\-v \-\-version\fR
Show version information\. Fisherman follows \fBSemantic Versioning\fR and uses Git annotated tags to track releases\.
\-v, \-\-version
Show version information\. Fisherman follows Semantic Versioning and uses Git annotated tags to track releases\.
.
.TP
\fB\-h \-\-help\fR
\-h, \-\-help
Show usage help\.
.
.SH "EXAMPLES"

View file

@ -1,34 +1,35 @@
Usage: fisher update [<plugins>] [--quiet] [--help]
Usage: fisher update [<plugins>] [--all] [--quiet] [--help]
-q --quiet Enable quiet mode
-h --help Show usage help
-a --all Update everything
-q --quiet Enable quiet mode
-h --help Show usage help
Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]
-f --force Delete copy from the cache
-q --quiet Enable quiet mode
-h --help Show usage help
-f --force Delete copy from the cache
-q --quiet Enable quiet mode
-h --help Show usage help
Usage: fisher search [<plugins>] [--long] [--full] [--no-color]
[--quiet] [--help]
--long Display results in long format
--full Display results in full format
-C --no-color Turn off color display
-q --quiet Enable quiet mode
-h --help Show usage help
--long Display results in long format
--full Display results in full format
-C --no-color Turn off color display
-q --quiet Enable quiet mode
-h --help Show usage help
Usage: fisher list [<file>] [--enabled] [--disabled] [--bare] [--link]
-b --bare List plugin without decorators
-l --link List plugins that are symbolic links
--enabled List plugins that are enabled
--disabled List plugins that are disabled
-h --help Show usage help
-b --bare List plugin without decorators
-l --link List plugins that are symbolic links
--enabled List plugins that are enabled
--disabled List plugins that are disabled
-h --help Show usage help
Usage: fisher install [<plugins>] [--force] [--quiet] [--help]
-f --force Reinstall given plugin/s
-q --quiet Enable quiet mode
-h --help Show usage help
-f --force Reinstall given plugin/s
-q --quiet Enable quiet mode
-h --help Show usage help
Usage: fisher help [<keyword>] [--all] [--guides] [--help]
-a --all List all the documentation
-g --guides List available guides
-h --help Show usage help
-a --all List all the documentation
-g --guides List available guides
-h --help Show usage help

View file

@ -0,0 +1,31 @@
set -l path $DIRNAME/.t-$TESTNAME-(random)
function -S setup
mkdir -p $path
function foobar
echo foobar
end
end
function -S teardown
rm -rf $path
functions -e foobar
end
test "$TESTNAME - Return the path where the plugin was created"
$path/foobar = (
pushd $path
__fisher_function_to_plugin foobar
popd
)
end
test "$TESTNAME - Create a file with the contents of the given function"
(functions foobar | xargs) = (
pushd $path
set -l plugin_path (__fisher_function_to_plugin foobar)
cat $plugin_path/foobar.fish | xargs
popd
)
end