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. * 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. * 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 ## [0.9.0][v090] - 2016-02-25
* Welcome aboard @jethrokuan, the newest Fisherman organization member. * 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]. **Fisherman** is a blazing fast, modern plugin manager for [fish].
&nbsp;&nbsp; **[Why?]**<br> &nbsp;&nbsp; **[Why?]**<br>
&nbsp;&nbsp; **[Quickstart]**<br> &nbsp;&nbsp; **[Get Started]**<br>
&nbsp;&nbsp; **[Plugins]**<br> &nbsp;&nbsp; **[Plugins]**<br>
&nbsp;&nbsp; **[Help]**<br> &nbsp;&nbsp; **[Help]**<br>
[travis-link]: https://travis-ci.org/fisherman/fisherman [travis-link]: https://travis-ci.org/fisherman/fisherman
[travis-badge]: https://img.shields.io/travis/fisherman/fisherman.svg?style=flat-square [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 [version-link]: https://github.com/fisherman/fisherman/releases
[slack-link]: https://fisherman-wharf.herokuapp.com/ [slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://img.shields.io/badge/slack-join%20the%20chat-00B9FF.svg?style=flat-square [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 [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 [Plugins]: http://fisherman.sh/#search
[Help]: https://github.com/fisherman/fisherman/wiki [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 function __fisher_deps_install -a path
for file in $path/{fishfile,bundle} for file in $path/{fishfile,bundle}
if test -s $file 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' fisher_install < $file | sed -En 's/^.+([0-9]+) plugin\/s.*/\1/p'
end end
end | awk '{ n = n + $0 } END { print n ? n : 0 }' end | awk '{ n = n + $0 } END { print n ? n : 0 }'

View file

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

View file

@ -6,7 +6,7 @@ function __fisher_file_remove -a plugin file
set pattern "/^$pattern\$/d" set pattern "/^$pattern\$/d"
end end
debug "Fishfile remove %s" "$plugin" debug "File remove %s" "$plugin"
sed -E "$pattern" < $file > $file.tmp 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 function __fisher_gist_to_name -a url
set -l id (printf "%s\n" "$url" | sed 's|.*/||') set -l id (printf "%s\n" "$url" | sed 's|.*/||')
debug "Get Gist information '%s'" $url
set -l name ( 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++ } /"files": / { files++ }

View file

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

View file

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

View file

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

View file

@ -7,12 +7,12 @@ function __fisher_path_update -a path
return 1 return 1
end end
git checkout master --quiet git checkout master --quiet ^ /dev/null
git stash --quiet ^ /dev/null git stash --quiet ^ /dev/null
if not git pull --rebase origin master --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 fetch origin master --quiet
git reset --hard FETCH_HEAD --quiet git reset --hard FETCH_HEAD --quiet
git clean -d --force --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 __fisher_plugin_walk "$plugin" "$path" | while read -l class source target name
switch "$class" switch "$class"
case --bind case --bind
debug "Disable key bindings '%s'" $plugin debug "Unbind %s" $plugin
__fisher_key_bindings_disable $plugin (__fisher_xdg --config __fisher_key_bindings_disable $plugin (__fisher_xdg --config
)/fish/functions/fish_user_key_bindings.fish )/fish/functions/fish_user_key_bindings.fish
@ -20,7 +20,7 @@ function __fisher_plugin_disable -a plugin path option
end end
if test -s $fisher_file if test -s $fisher_file
debug "Remove from fishfile %s" "$plugin" debug "File remove %s" "$plugin"
__fisher_file_remove ( __fisher_file_remove (
if not fisher_search --name=$plugin --name --index=$fisher_cache/.index if not fisher_search --name=$plugin --name --index=$fisher_cache/.index

View file

@ -1,18 +1,9 @@
function __fisher_plugin_enable -a plugin path function __fisher_plugin_enable -a plugin path
debug "Plugin enable %s" "$plugin" debug "Enable %s" "$plugin"
if __fisher_path_is_prompt $path if __fisher_path_is_prompt $path
if test ! -z "$fisher_prompt" if test ! -z "$fisher_prompt"
debug "Enable prompt %s" $plugin
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.
__fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt" __fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt"
end end
@ -22,22 +13,13 @@ function __fisher_plugin_enable -a plugin path
set -l link -f set -l link -f
if test -L $path 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 set link -sfF
end end
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target __unused __fisher_plugin_walk "$plugin" "$path" | while read -l class source target __unused
switch "$class" switch "$class"
case --bind case --bind
debug "Enable key bindings %s" $source debug "Bind %s" $source
__fisher_key_bindings_enable $plugin (__fisher_xdg --config __fisher_key_bindings_enable $plugin (__fisher_xdg --config
)/fish/functions/fish_user_key_bindings.fish < $source )/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 test -s $fisher_file
if __fisher_file_contains "$item" --quiet $fisher_file if __fisher_file_contains "$item" --quiet $fisher_file
debug "Fishfile skip %s" "$item" debug "File skip %s" "$item"
return return
end end
end end
debug "Fishfile add %s" "$item" debug "File add %s" "$item"
printf "%s\n" $item >> $fisher_file printf "%s\n" $item >> $fisher_file
end end

View file

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

View file

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

View file

@ -1,6 +1,4 @@
function __fisher_prompt_reset function __fisher_prompt_reset
debug "Reset prompt '%s'" "$fisher_prompt"
set -U fisher_prompt set -U fisher_prompt
# To reset the prompt, remove any data in fisher_prompt and source any existing # 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 for prompt in $argv/functions/fish_prompt.fish
if test -s $prompt if test -s $prompt
debug "Default prompt '%s'" $prompt debug "Reset prompt %s" $prompt
source $prompt source $prompt
return 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 file $config/fish/functions/fish_prompt.fish
set -l sum_before (cksum $file ^ /dev/null | awk '{ print $1 + $2 }') 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 eval $__fish_datadir/tools/web_config/webconfig.py $tab
debug "fish_config end"
if test ! -z "$fisher_prompt" if test ! -z "$fisher_prompt"
set -l sum_after (cksum $file ^ /dev/null | awk '{ print $1 + $2 }') 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 case h
printf "Usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n" printf "Usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
printf " -a --all List all the documentation\n" printf " -a --all List all the documentation\n"
printf " -g --guides List available guides\n" printf " -g --guides List available guides\n"
printf " -h --help Show usage help\n" printf " -h --help Show usage help\n"
return return
case \* case \*

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,11 +49,11 @@ Fisherman knows the following aliases by default: \fIi\fR for install, \fIu\fR f
.SH "OPTIONS" .SH "OPTIONS"
. .
.TP .TP
\fB\-v \-\-version\fR \-v, \-\-version
Show version information\. Fisherman follows \fBSemantic Versioning\fR and uses Git annotated tags to track releases\. Show version information\. Fisherman follows Semantic Versioning and uses Git annotated tags to track releases\.
. .
.TP .TP
\fB\-h \-\-help\fR \-h, \-\-help
Show usage help\. Show usage help\.
. .
.SH "EXAMPLES" .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 -a --all Update everything
-h --help Show usage help -q --quiet Enable quiet mode
-h --help Show usage help
Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help] Usage: fisher uninstall [<plugins>] [--force] [--quiet] [--help]
-f --force Delete copy from the cache -f --force Delete copy from the cache
-q --quiet Enable quiet mode -q --quiet Enable quiet mode
-h --help Show usage help -h --help Show usage help
Usage: fisher search [<plugins>] [--long] [--full] [--no-color] Usage: fisher search [<plugins>] [--long] [--full] [--no-color]
[--quiet] [--help] [--quiet] [--help]
--long Display results in long format --long Display results in long format
--full Display results in full format --full Display results in full format
-C --no-color Turn off color display -C --no-color Turn off color display
-q --quiet Enable quiet mode -q --quiet Enable quiet mode
-h --help Show usage help -h --help Show usage help
Usage: fisher list [<file>] [--enabled] [--disabled] [--bare] [--link] Usage: fisher list [<file>] [--enabled] [--disabled] [--bare] [--link]
-b --bare List plugin without decorators -b --bare List plugin without decorators
-l --link List plugins that are symbolic links -l --link List plugins that are symbolic links
--enabled List plugins that are enabled --enabled List plugins that are enabled
--disabled List plugins that are disabled --disabled List plugins that are disabled
-h --help Show usage help -h --help Show usage help
Usage: fisher install [<plugins>] [--force] [--quiet] [--help] Usage: fisher install [<plugins>] [--force] [--quiet] [--help]
-f --force Reinstall given plugin/s -f --force Reinstall given plugin/s
-q --quiet Enable quiet mode -q --quiet Enable quiet mode
-h --help Show usage help -h --help Show usage help
Usage: fisher help [<keyword>] [--all] [--guides] [--help] Usage: fisher help [<keyword>] [--all] [--guides] [--help]
-a --all List all the documentation -a --all List all the documentation
-g --guides List available guides -g --guides List available guides
-h --help Show usage help -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