From 6c5cac3a186bacc86b1abac001d8805b38e28872 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Thu, 31 Mar 2016 02:42:44 +0900 Subject: [PATCH] Ahoy! Fisherman 1.4.0 has shipped. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notable changes: + Now fisher list does not show plugins that are disabled, but available in the cache. To preview these items use fisher list --disabled. + Welcome aboard @orangecms and @xrain0610. + Fisherman is now available in AUR, thanks @orangecms. + Fix load order during installation. Now snippets can safely invoke functions defined in the plugin function directory. Thanks @orangecms. #170. + Fisherman **installs and updates plugins ⌁concurrently**. Performance may vary, but if you can see 5 to 10 times faster network times, it's working well. --- CHANGELOG.md | 12 +- README.md | 4 +- functions/__fisher_cache_list.fish | 2 +- functions/__fisher_deps_install.fish | 7 - functions/__fisher_file_remove.fish | 2 - functions/__fisher_function_to_plugin.fish | 12 -- functions/__fisher_index_update.fish | 2 +- functions/__fisher_key_bindings_enable.fish | 2 +- functions/__fisher_path_make.fish | 4 +- functions/__fisher_plugin_can_enable.fish | 5 - functions/__fisher_plugin_disable.fish | 5 +- functions/__fisher_plugin_enable.fish | 20 +-- functions/__fisher_plugin_fetch.fish | 127 ++++++++++++++++ functions/__fisher_plugin_link.fish | 2 +- functions/__fisher_plugin_unlink.fish | 4 +- functions/__fisher_plugin_validate.fish | 4 + functions/__fisher_plugin_walk.fish | 8 +- functions/__fisher_prompt_reset.fish | 7 +- functions/__fisher_url_clone.fish | 2 +- functions/fish_config.fish | 2 +- functions/fisher.fish | 19 +-- functions/fisher_help.fish | 4 +- functions/fisher_install.fish | 160 +++----------------- functions/fisher_list.fish | 49 +++--- functions/fisher_search.fish | 14 +- functions/fisher_uninstall.fish | 53 +++---- functions/fisher_update.fish | 64 ++++---- man/man1/fisher-install.1 | 3 +- man/man1/fisher-install.md | 10 +- man/man1/fisher-list.1 | 6 +- man/man1/fisher-list.md | 23 +-- man/man1/fisher-search.1 | 11 +- man/man1/fisher-search.md | 10 +- man/man1/fisher-uninstall.md | 8 +- man/man1/fisher-update.md | 10 +- man/man1/fisher.1 | 4 +- man/man1/fisher.md | 34 ++--- test/deps-install.fish | 31 ---- test/function-to-plugin.fish | 31 ---- test/helpers/config-mock.fish | 6 - test/install.fish | 6 +- test/list.fish | 27 +--- test/uninstall.fish | 2 +- 43 files changed, 336 insertions(+), 482 deletions(-) delete mode 100644 functions/__fisher_deps_install.fish delete mode 100644 functions/__fisher_function_to_plugin.fish create mode 100644 functions/__fisher_plugin_fetch.fish delete mode 100644 test/deps-install.fish delete mode 100644 test/function-to-plugin.fish diff --git a/CHANGELOG.md b/CHANGELOG.md index d06f36f..dd3fb29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,18 @@ # Change Log -## [1.4.0][v140] - Not released yet. +## [1.4.0][v140] - 2016-03-31 -* Welcome aboard @orangecms. +* :warning: Deprecate --force flag in fisher install. + +* Now fisher list does not show plugins that are disabled, but available in the cache. To see these items use fisher list --disabled. + +* Welcome aboard @orangecms and @xrain0610. * Fisherman is now [available](https://aur.archlinux.org/packages/fisherman-git/) in the Arch User Repository. * Fix load order during installation. Now snippets can safely invoke functions defined in the plugin function directory. Thanks @orangecms. #170. -* Fisherman updates plugins in **⌁ parallel** now. Performance will vary, but chances are you will perceive 3 to 10 times faster updates. +* Fisherman installs and updates plugins in **⌁ parallel** now. Performance will vary, but chances are you will perceive 3 to 10 times faster updates. ![para](https://cloud.githubusercontent.com/assets/8317250/13730493/5b704bec-e994-11e5-81b9-d3af2c0f9821.gif) @@ -18,8 +22,6 @@ fisher list - < file ``` -* Revise documentation. - ## [1.3.1][v131] - 2016-03-12 * Fix bug in fisher_config_color_reset not declaring path variable. diff --git a/README.md b/README.md index 9562d6f..172a5c8 100644 --- a/README.md +++ b/README.md @@ -102,8 +102,8 @@ List installed plugins. fisher list debug * fishtape -> shellder * spin +> superman @ wipe ``` @@ -119,7 +119,7 @@ fisher search fzf Efficient keybindings for fzf get Press any key to continue ... -> shellder Powerline prompt optimized for speed +> superman Powerline prompt based on Superman ... ``` diff --git a/functions/__fisher_cache_list.fish b/functions/__fisher_cache_list.fish index 7f3879f..c1dfe35 100644 --- a/functions/__fisher_cache_list.fish +++ b/functions/__fisher_cache_list.fish @@ -1,3 +1,3 @@ function __fisher_cache_list - find -L $fisher_cache/* -maxdepth 0 -type d ^ /dev/null | sed 's|.*/||' + command find -L $fisher_cache/* -maxdepth 0 -type d ^ /dev/null | sed 's|.*/||' end diff --git a/functions/__fisher_deps_install.fish b/functions/__fisher_deps_install.fish deleted file mode 100644 index 568e8d6..0000000 --- a/functions/__fisher_deps_install.fish +++ /dev/null @@ -1,7 +0,0 @@ -function __fisher_deps_install -a path - for file in $path/{fishfile,bundle} - if test -s $file - fisher_install < $file | sed -En 's|^([0-9]+) plugin/s installed.*|\1|p' - end - end | awk '{ n = n + $0 } END { print n ? n : 0 }' -end diff --git a/functions/__fisher_file_remove.fish b/functions/__fisher_file_remove.fish index fe863a8..a052762 100644 --- a/functions/__fisher_file_remove.fish +++ b/functions/__fisher_file_remove.fish @@ -6,8 +6,6 @@ function __fisher_file_remove -a plugin file set pattern "/^$pattern\$/d" end - debug "File remove %s" "$plugin" - sed -E "$pattern" < $file > $file.tmp command mv $file.tmp $file diff --git a/functions/__fisher_function_to_plugin.fish b/functions/__fisher_function_to_plugin.fish deleted file mode 100644 index aaba5ba..0000000 --- a/functions/__fisher_function_to_plugin.fish +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/functions/__fisher_index_update.fish b/functions/__fisher_index_update.fish index fb7c682..a2a676a 100644 --- a/functions/__fisher_index_update.fish +++ b/functions/__fisher_index_update.fish @@ -16,7 +16,7 @@ function __fisher_index_update -a timeout set -l index $fisher_cache/.index.tmp if test -z "$url" - # Force the server to return the latest copy of the index using a fake query string. + # force the server to return the latest copy of the index using a fake query string set url https://raw.githubusercontent.com/fisherman/fisher-index/master/index\?(date +%s) end diff --git a/functions/__fisher_key_bindings_enable.fish b/functions/__fisher_key_bindings_enable.fish index 448d8cb..6809b70 100644 --- a/functions/__fisher_key_bindings_enable.fish +++ b/functions/__fisher_key_bindings_enable.fish @@ -12,7 +12,7 @@ function __fisher_key_bindings_enable -a plugin user_key_bindings source $user_key_bindings end - debug "Bind %s" "$user_key_bindings" + debug "binds %s" "$user_key_bindings" functions fish_user_key_bindings \ | __fisher_key_bindings_update_user > $user_key_bindings diff --git a/functions/__fisher_path_make.fish b/functions/__fisher_path_make.fish index 7f8045f..c155ab5 100644 --- a/functions/__fisher_path_make.fish +++ b/functions/__fisher_path_make.fish @@ -3,14 +3,14 @@ function __fisher_path_make -a path return end - debug "Make %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 diff --git a/functions/__fisher_plugin_can_enable.fish b/functions/__fisher_plugin_can_enable.fish index 4cd55b0..e23cee5 100644 --- a/functions/__fisher_plugin_can_enable.fish +++ b/functions/__fisher_plugin_can_enable.fish @@ -1,9 +1,4 @@ function __fisher_plugin_can_enable -a name path - - # Check whether a plugin is the current prompt or not a prompt. We use this - # method when the user is trying to Update or Uninstall a prompt that is not - # currently enabled, and we wish to skip only the enable / disable phase. - if not __fisher_path_is_prompt $path return 0 end diff --git a/functions/__fisher_plugin_disable.fish b/functions/__fisher_plugin_disable.fish index 3bf6bcc..b3ff9a1 100644 --- a/functions/__fisher_plugin_disable.fish +++ b/functions/__fisher_plugin_disable.fish @@ -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 "Unbind %s" $plugin + debug "unbind %s" $plugin __fisher_key_bindings_disable $plugin (__fisher_xdg --config )/fish/functions/fish_user_key_bindings.fish @@ -27,12 +27,11 @@ function __fisher_plugin_disable -a plugin path option set -l key if not set key (fisher_search --name=$plugin --name --index=$fisher_cache/.index) - debug "Path $path" set key (__fisher_url_from_path $path) end debug "fishfile remove %s start" "$key" - + if set key (__fisher_file_remove "$key" "$fisher_file") debug "fishfile remove %s ok" "$key" else diff --git a/functions/__fisher_plugin_enable.fish b/functions/__fisher_plugin_enable.fish index 392b640..a728b5b 100644 --- a/functions/__fisher_plugin_enable.fish +++ b/functions/__fisher_plugin_enable.fish @@ -1,25 +1,21 @@ function __fisher_plugin_enable -a plugin path - debug "Enable %s" "$plugin" + debug "enable %s" "$plugin" if __fisher_path_is_prompt $path if test ! -z "$fisher_prompt" - debug "Disable prompt %s" $fisher_prompt + debug "disable prompt %s" $fisher_prompt __fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt" end set -U fisher_prompt $plugin end - set -l link -f - - if test -L $path - set link -sfF - end + set -l link -sfF __fisher_plugin_walk "$plugin" "$path" | while read -l class source target name switch "$class" case --bind - debug "Bind %s" $source + debug "bind %s" $source __fisher_key_bindings_enable $plugin (__fisher_xdg --config )/fish/functions/fish_user_key_bindings.fish < $source @@ -33,11 +29,11 @@ function __fisher_plugin_enable -a plugin path __fisher_plugin_link $link $source $fisher_config/$target if test "$class" = --source - debug "Source %s" "$fisher_config/$target" + debug "source %s" "$fisher_config/$target" __fisher_plugin_source $plugin $fisher_config/$target if test "$name" = set_color_custom - debug "Colors" + debug "color save" __fisher_config_color_save "$fisher_config/fish_colors" set_color_custom end @@ -53,12 +49,12 @@ function __fisher_plugin_enable -a plugin path if test -s $fisher_file if __fisher_file_contains "$item" --quiet $fisher_file - debug "File skip %s" "$item" + debug "file skip %s" "$item" return end end - debug "File add %s" "$item" + debug "file add %s" "$item" printf "%s\n" $item >> $fisher_file end diff --git a/functions/__fisher_plugin_fetch.fish b/functions/__fisher_plugin_fetch.fish new file mode 100644 index 0000000..685bd48 --- /dev/null +++ b/functions/__fisher_plugin_fetch.fish @@ -0,0 +1,127 @@ +function -S __fisher_plugin_fetch + set -l plugins + set -l fetched + + for item in $argv + if not set item (__fisher_plugin_validate "$item") + printf "fisher: '%s' is not a valid plugin\n" "$item" > $stderr + debug "validate fail %s" "$item" + continue + end + + debug "validate ok %s" "$item" + + if contains -- "$item" $enabled + if test -z "$option" + set skipped $skipped "$item" + debug "skip %s" "$item" + continue + end + end + + switch "$item" + case \*/\* + set plugins $plugins "$item" + debug "url or path %s" $item + + case \* + if test -d "$fisher_cache/$item" + set -l url (__fisher_url_from_path "$fisher_cache/$item") + + if test ! -z "$url" + set plugins $plugins "$url" + end + + debug "cache %s" "$item" + + else + if test ! -s $fisher_cache/.index + if spin "__fisher_index_update" --error=/dev/null > /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) + set plugins $plugins "$url" + debug "name %s" $item + + else + printf "fisher: I couldn't find '%s' in the index\n" $item > $stderr + end + end + end + end + + for plugin in $plugins + set -l name (echo $plugin | __fisher_name) + set -l path $fisher_cache/$name + + switch "$plugin" + case {https://,}gist.github.com\* + debug "gist %s" $item + + if not set name (__fisher_gist_to_name $plugin) + printf "fisher: I could not find your gist\n" > $stderr + continue + end + end + + printf "%s\n" "$name" + debug "plugin %s" "$name" + + if test ! -e $path + if not set -q __fisher_fetch_status + set -g __fisher_fetch_status + printf "Installing plugin/s\n" > $stderr + + else if test "$__fisher_fetch_status" = "deep" + printf "Installing dependencies\n" > $stderr + set -g __fisher_fetch_status done + end + + set fetched $fetched "$path" + + if test -d "$plugin" + debug "link %s" "$plugin" + command ln -sfF $plugin $path + + else + debug "clone %s" "$plugin" + fish -ic " + spin ' + if __fisher_url_clone $plugin $path + printf \" %-20s\n\" \"$name\" + end + ' > $stderr + " & + end + end + end + + if test ! -z "$plugins" + while true + set -l has_jobs (jobs) + if test -z "$has_jobs" + break + end + end + end + + switch "$__fisher_fetch_status" + case done deep + case \* + set __fisher_fetch_status deep + end + + for path in $fetched + for file in $path/{fishfile,bundle} + if test -s $file + __fisher_plugin_fetch (__fisher_file < $file) + end + end + end + + set -e __fisher_fetch_status +end diff --git a/functions/__fisher_plugin_link.fish b/functions/__fisher_plugin_link.fish index 3b6cbfe..87707da 100644 --- a/functions/__fisher_plugin_link.fish +++ b/functions/__fisher_plugin_link.fish @@ -1,4 +1,4 @@ function __fisher_plugin_link -a options source target - debug "Link %s" $target + debug "link %s" $target command ln $options $source $target end diff --git a/functions/__fisher_plugin_unlink.fish b/functions/__fisher_plugin_unlink.fish index 89635bb..7c0dd0e 100644 --- a/functions/__fisher_plugin_unlink.fish +++ b/functions/__fisher_plugin_unlink.fish @@ -1,9 +1,9 @@ function __fisher_plugin_unlink -a file name - debug "Unlink %s" $file + debug "unlink %s" $file command rm -f $file if test ! -z "$name" - debug "Erase %s" $name + debug "erase %s" $name functions -e $name end end diff --git a/functions/__fisher_plugin_validate.fish b/functions/__fisher_plugin_validate.fish index 8445753..b70a355 100644 --- a/functions/__fisher_plugin_validate.fish +++ b/functions/__fisher_plugin_validate.fish @@ -1,4 +1,8 @@ function __fisher_plugin_validate -a plugin + if test -z "$plugin" + return 1 + end + if set -q argv[2] printf "%s\n" "$argv" return 1 diff --git a/functions/__fisher_plugin_walk.fish b/functions/__fisher_plugin_walk.fish index 5710209..aee5b2e 100644 --- a/functions/__fisher_plugin_walk.fish +++ b/functions/__fisher_plugin_walk.fish @@ -1,11 +1,11 @@ function __fisher_plugin_walk -a plugin path - debug "Walk %s" "$path" + debug "walk %s" "$path" for file in $path/{functions/**,*,{conf.d,modules}/*}.{fish,load} $path/completions/*.fish set -l name (basename $file .fish) set -l base $name.fish - debug "File %s" $file + debug "file %s" $file switch $file case \*/{fish_user_,}key_bindings.fish @@ -41,14 +41,14 @@ function __fisher_plugin_walk -a plugin path set -l prefix functions set -l target $prefix/(basename $file) - debug "Script %s" $target + debug "script %s" $target printf "%s %s %s\n" -- $file $target end for n in (seq 9) for file in $path/man/man$n/*.$n - debug "Man %s" $file + debug "man$n %s" $file printf "%s %s %s\n" --man $file man/man$n/(basename $file) end diff --git a/functions/__fisher_prompt_reset.fish b/functions/__fisher_prompt_reset.fish index 272649a..f91c6d3 100644 --- a/functions/__fisher_prompt_reset.fish +++ b/functions/__fisher_prompt_reset.fish @@ -1,16 +1,11 @@ function __fisher_prompt_reset set -U fisher_prompt - # To reset the prompt, remove any data in fisher_prompt and source any existing - # fish_prompt file as follows. First, look inside functions/ inside each of the - # given paths. If none are given, look in the user fish configuration. If none - # is found, source the default prompt inside __fish_datadir/functions. - set argv $argv (__fisher_xdg --config)/fish $__fish_datadir for prompt in $argv/functions/fish_prompt.fish if test -s $prompt - debug "Reset prompt %s" $prompt + debug "reset prompt %s" $prompt source $prompt return diff --git a/functions/__fisher_url_clone.fish b/functions/__fisher_url_clone.fish index 133a86b..aee408b 100644 --- a/functions/__fisher_url_clone.fish +++ b/functions/__fisher_url_clone.fish @@ -1,4 +1,4 @@ function __fisher_url_clone -a url path - set -lx GIT_ASKPASS /bin/echo + set -lx GIT_ASKPASS /bin/echo git clone -q --depth 1 $url $path end diff --git a/functions/fish_config.fish b/functions/fish_config.fish index a498f26..7eb0c1c 100644 --- a/functions/fish_config.fish +++ b/functions/fish_config.fish @@ -17,7 +17,7 @@ function fish_config -d "Launch fish's web based configuration" -a tab debug "fish_prompt check sum after: %s" $sum_after if test "$sum_before" != "$sum_after" - debug "Uninstall %s" "$fisher_prompt" + debug "uninstall %s" "$fisher_prompt" fisher_uninstall "$fisher_prompt" -q end end diff --git a/functions/fisher.fish b/functions/fisher.fish index 5a9d403..cc0edc0 100644 --- a/functions/fisher.fish +++ b/functions/fisher.fish @@ -1,4 +1,4 @@ -function fisher -d "Fish plugin manager" +function fisher -d "fish plugin manager" set -l value set -l option help @@ -17,7 +17,7 @@ function fisher -d "Fish plugin manager" set option version case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher -h > /dev/stderr return 1 end @@ -26,7 +26,7 @@ function fisher -d "Fish plugin manager" switch "$option" case command set -l IFS = - set -l default_alias install=i update=u search=s list=l help=h new=n + set -l default_alias install=i update=u search=s list=l help=h new=n uninstall=r printf "%s\n" $fisher_alias $default_alias | while read -l command alias if test "$value" = "$alias" @@ -62,19 +62,8 @@ function fisher -d "Fish plugin manager" printf "Commands:\n" __fisher_help_commands | sed " - s/^/ / s/;/"\t" / - - " | column -ts\t | sed -E " - s/^ (h)(elp)/ $color\1$color_normal\2/ - s/^ (i)(nstall)/ $color\1$color_normal\2/ - s/^ (s)(earch)/ $color\1$color_normal\2/ - s/^ (u)(pdate)/ $color\1$color_normal\2/ - s/^ (l)(ist)/ $color\1$color_normal\2/ - s/^ (n)(ew)/ $color\1$color_normal\2/ - " - - printf "\nUse fisher help to get help.\n" + " | column -ts\t end end diff --git a/functions/fisher_help.fish b/functions/fisher_help.fish index 957b833..9bdecca 100644 --- a/functions/fisher_help.fish +++ b/functions/fisher_help.fish @@ -1,4 +1,4 @@ -function fisher_help -d "Show command help" + function fisher_help -d "Show command help (h)" if not set -q argv[1] man fisher return @@ -22,7 +22,7 @@ function fisher_help -d "Show command help" return case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher_help -h > /dev/stderr return 1 end diff --git a/functions/fisher_install.fish b/functions/fisher_install.fish index fbb065a..6b99a11 100644 --- a/functions/fisher_install.fish +++ b/functions/fisher_install.fish @@ -1,168 +1,54 @@ -function fisher_install -d "Install plugins" - set -l plugins +function fisher_install -d "Install plugins (i)" + set -l items set -l option set -l stdout /dev/stdout set -l stderr /dev/stderr - set -l color (set_color $fish_color_match) - set -l color_normal (set_color normal) getopts $argv | while read -l 1 2 switch "$1" case _ - set plugins $plugins $2 - - case f force - set option force - - if test ! -z "$2" - set plugins $plugins $2 - end - - case C no-color - set color - set color_normal + set items $items $2 case q quiet set stdout /dev/null set stderr /dev/null case h - printf "Usage: fisher install [] [--force] [--quiet] [--help]\n\n" - printf " -f --force Reinstall given plugin/s\n" + printf "Usage: fisher install [] [--quiet] [--help]\n\n" printf " -q --quiet Enable quiet mode\n" - printf " -C --no-color Turn off color display\n" printf " -h --help Show usage help\n" return case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher_install -h > /dev/stderr return 1 end end - set -l link + command mkdir -p $fisher_cache $fisher_config/{functions,completions,conf.d,man} + set -l time (date +%s) set -l count 0 set -l index 1 - set -l total (count $plugins) set -l skipped - set -l indicator "▸" + set -l enabled (fisher_list --enabled) - set -l IFS \t + if test -z "$items" + __fisher_file | read -az items + end - if set -q plugins[1] - printf "%s\n" $plugins - else - __fisher_file + set -l plugins (__fisher_plugin_fetch $items | awk '!seen[$0]++') - end | while read -l item - debug "Validate %s" $item + for plugin in $plugins + set -l path $fisher_cache/$plugin - 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 + if test -d $path + __fisher_path_make "$path" --quiet + __fisher_plugin_enable "$plugin" "$path" + + set count (math $count + 1) end - - debug "Validate ok %s" $item - - switch "$item" - case https://gist.github.com\* - debug "Gist %s" $item - - if set -l name (__fisher_gist_to_name $item ) - printf "%s\t%s\n" $item $name - else - printf "fisher: Repository '%s' not found.\n" $item > $stderr - end - - case \*/\* - debug "URL or path %s" $item - - printf "%s\t%s\n" "$item" (printf "%s\n" "$item" | __fisher_name) - - case \* - 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 - if test ! -s $fisher_cache/.index - if spin "__fisher_index_update" --error=/dev/null > /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 if functions -q "$item" - set -l path - if set path (__fisher_function_to_plugin $item) - printf "%s\t%s" "$path" $item - else - printf "fisher: '%s' is a directory in %s.\n" $item $PWD > $stderr - end - else - printf "fisher: I couldn't find '%s' in the index.\n" $item > $stderr - end - end - end - - end | while read -l url name - if contains -- $name (fisher_list --enabled) - if test -z "$option" - set skipped $skipped $name - continue - end - end - - printf "$indicator Installing " > $stderr - - switch $total - case 0 1 - printf "%s\n" $name > $stderr - - case \* - printf "(%s of %s) %s\n" $index $total $name > $stderr - set index (math $index + 1) - end - - command mkdir -p $fisher_config/{functions,completions,conf.d,man} $fisher_cache - - set -l path $fisher_cache/$name - - if test ! -e $path - if test -d "$url" - debug "Link %s" $url - - command ln -sfF $url $path - else - debug "Clone %s" $url - - if not spin "__fisher_url_clone $url $path" --error=$stderr -f " $color@\r$color_normal" - continue - end - end - end - - set -l deps (__fisher_deps_install "$path") - - if test "$deps" -gt 0 - debug "Install deps ok" - end - - if not __fisher_path_make "$path" --quiet - continue - end - - __fisher_plugin_enable "$name" "$path" - - set count (math $count + 1 + "0$deps") end set time (math (date +%s) - $time) @@ -173,16 +59,14 @@ function fisher_install -d "Install plugins" end if test "$count" -le 0 - printf "No plugins were installed.\n" > $stdout + printf "No plugins were installed\n" > $stdout return 1 end - debug "Reset completions and key bindings start" - __fisher_complete_reset __fisher_key_bindings_reset - debug "Reset completions and key bindings ok" + debug "complete and key binds reset" - printf "%d plugin/s installed in %0.fs\n" $count $time > $stdout + printf "%d plugin/s installed (%0.fs)\n" $count $time > $stdout end diff --git a/functions/fisher_list.fish b/functions/fisher_list.fish index 11949ee..8337126 100644 --- a/functions/fisher_list.fish +++ b/functions/fisher_list.fish @@ -1,4 +1,4 @@ -function fisher_list -a key -d "List installed plugins" +function fisher_list -a key -d "List installed plugins (l)" set -l enabled if test -f "$fisher_file" @@ -7,37 +7,31 @@ function fisher_list -a key -d "List installed plugins" switch "$key" case "" - set -l cache (__fisher_cache_list) + set -l indent + set -l links (command find $fisher_cache/* -maxdepth 0 -type l ^ /dev/null | sed 's|.*/||') - if test -z "$cache" - return 1 + if test ! -z "$fisher_prompt" + set indent " " end - set -l indent " " - - if test -z "$enabled" - set indent "" - end - - for i in $cache - if contains -- $i $enabled - if test $i = "$fisher_prompt" - printf "%s%s\n" ">$indent" $i - - else if test -L $fisher_cache/$i - - printf "%s%s\n" "@$indent" $i - - else - printf "%s%s\n" "*$indent" $i - end - else - printf "%s%s\n" "$indent$indent" $i + for plugin in $links + if contains -- "$plugin" $enabled + set indent " " + break end end - case -l --link - find $fisher_cache/* -maxdepth 0 -type l ^ /dev/null | sed 's|.*/||' + for plugin in $enabled + if contains -- "$plugin" $links + printf "%s %s\n" "@" $plugin + + else if test $plugin = "$fisher_prompt" + printf "%s %s\n" ">" $plugin + + else + printf "$indent$indent%s\n" $plugin + end + end case --enabled if test ! -z "$enabled" @@ -55,8 +49,7 @@ function fisher_list -a key -d "List installed plugins" __fisher_list case -h - printf "Usage: fisher list [--enabled] [--disabled] [--link]\n\n" - printf " -l --link List plugins that are symbolic links\n" + printf "Usage: fisher list [--enabled] [--disabled] [--help]\n\n" printf " --enabled List plugins that are enabled\n" printf " --disabled List plugins that are disabled\n" printf " -h --help Show usage help\n" diff --git a/functions/fisher_search.fish b/functions/fisher_search.fish index 00979f7..63e6c55 100644 --- a/functions/fisher_search.fish +++ b/functions/fisher_search.fish @@ -1,4 +1,4 @@ -function fisher_search -d "Search plugin index" +function fisher_search -d "Search plugin index (s)" set -l fields set -l query set -l index @@ -6,7 +6,7 @@ function fisher_search -d "Search plugin index" set -l format set -l option set -l stdout /dev/stdout - set -l color (set_color $fish_color_match) + set -l color (set_color $fish_color_quote) set -l color_normal (set_color normal) getopts $argv | while read -l 1 2 3 @@ -87,7 +87,7 @@ function fisher_search -d "Search plugin index" return case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher_search -h > /dev/stderr return 1 end @@ -105,7 +105,7 @@ 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 -f " $color@$color_normal\r" > /dev/null + if spin "__fisher_index_update" --error=/dev/null > /dev/null debug "Update index ok" __fisher_complete_reset else @@ -132,9 +132,9 @@ function fisher_search -d "Search plugin index" end end - set -l color_name (set_color $fish_color_command -o) - set -l color_url (set_color $fish_color_quote -u) - set -l color_tag (set_color $fish_color_quote) + set -l color_name (set_color $fish_color_quote) + set -l color_url (set_color $fish_color_end -u) + set -l color_tag (set_color $fish_color_command) set -l color_weak (set_color white -o) set -l color_author (set_color -u) set -l color_normal (set_color $fish_color_normal) diff --git a/functions/fisher_uninstall.fish b/functions/fisher_uninstall.fish index 7ef0e50..148e3fa 100644 --- a/functions/fisher_uninstall.fish +++ b/functions/fisher_uninstall.fish @@ -1,4 +1,4 @@ -function fisher_uninstall -d "Uninstall plugins" +function fisher_uninstall -d "Uninstall plugins (r)" set -l plugins set -l option set -l stdout /dev/stdout @@ -28,74 +28,63 @@ function fisher_uninstall -d "Uninstall plugins" return case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher_uninstall -h > /dev/stderr return 1 end end - set -l time (date +%s) set -l count 0 - set -l index 1 - set -l total (count $plugins) set -l skipped - set -l indicator "▸" + set -l time (date +%s) set -l IFS \t + printf "Uninstalling\n" > $stderr + if set -q plugins[1] 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 + debug "validate fail %s" $item + printf "fisher: '%s' is not a valid plugin\n" $item > $stderr continue end - debug "Validate ok %s" $item + debug "validate ok %s" $item if not set path (__fisher_path_from_plugin $item) - printf "fisher: '%s' not found\n" $item > $stderr + printf "fisher: I could not find '%s'\n" $item > $stderr continue end set -l name (printf "%s\n" $path | __fisher_name) - debug "Uninstall %s" "$name" - if not contains -- $name (fisher_list --enabled) if test -z "$option" + debug "skip %s" "$name" + set skipped $skipped $name continue end end - printf "$indicator Uninstalling " > $stderr - - switch $total - case 0 1 - printf "%s\n" $name > $stderr - - case \* - printf "(%s of %s) %s\n" $index $total $name > $stderr - set index (math $index + 1) - end + printf " %-22s\n" "$name" > $stdout + debug "uninstall %s" "$name" if __fisher_plugin_can_enable "$name" "$path" - debug "Disable %s[:%s]" "$name" "$option" __fisher_plugin_disable "$name" "$path" "$option" - else - debug "Disable skip %s" "$name" + debug "disable %s[:%s]" "$name" "$option" end if test "$option" = force - debug "Delete %s" "$path" command rm -rf $path + debug "remove %s" "$path" end set count (math $count + 1) @@ -106,20 +95,18 @@ function fisher_uninstall -d "Uninstall plugins" if test ! -z "$skipped" printf "%s plugin/s skipped (%s)\n" (count $skipped) ( printf "%s\n" $skipped | paste -sd ' ' - - ) > $stdout + ) > $stderr end if test $count -le 0 - printf "No plugins were uninstalled.\n" > $stdout + printf "No plugins were uninstalled\n" > $stderr return 1 end - debug "Reset completions and key bindings start" - __fisher_complete_reset __fisher_key_bindings_reset - debug "Reset completions and key bindings ok" + debug "complete / key bindings reset" - printf "%d plugin/s uninstalled in %0.fs\n" $count $time > $stdout + printf "%d plugin/s uninstalled in %0.fs\n" $count $time > $stderr end diff --git a/functions/fisher_update.fish b/functions/fisher_update.fish index 6af906f..290772e 100644 --- a/functions/fisher_update.fish +++ b/functions/fisher_update.fish @@ -1,9 +1,9 @@ -function fisher_update -d "Update plugins" +function fisher_update -d "Update plugins (u)" set -l items set -l plugins + set -l enabled (fisher_list --enabled) set -l stdout /dev/stdout set -l stderr /dev/stderr - set -l indicator "▸" getopts $argv | while read -l 1 2 switch "$1" @@ -21,7 +21,7 @@ function fisher_update -d "Update plugins" return case \* - printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr + printf "fisher: '%s' is not a valid option\n" $1 > /dev/stderr fisher_update -h > /dev/stderr return 1 end @@ -39,53 +39,55 @@ function fisher_update -d "Update plugins" set -l time (date +%s) set -l previous_version (cat $fisher_home/VERSION) - debug "Update %s" $fisher_cache/.index - debug "Update %s" $fisher_home + debug "update %s" $fisher_cache/.index + debug "update %s" $fisher_home if not spin "__fisher_index_update 0" --error=$stderr - debug "Update Index fail" + debug "update index fail" end if not spin "__fisher_path_update $fisher_home" --error=$stderr - debug "Update Fisherman fail" + debug "update fisherman fail" - printf "fisher: I couldn't update Fisherman.\n\n" > $stderr + printf "fisher: I couldn't update Fisherman\n\n" > $stderr return 1 end - debug "Update Fisherman ok" + debug "update fisherman ok" set -l new_version (cat $fisher_home/VERSION) if test "$new_version" != "$previous_version" - printf "$indicator Aye! Fisherman updated from %s to %s (%0.fs)\n" \ + printf "Aye! Fisherman updated from %s to %s (%0.fs)\n" \ "$previous_version" "$new_version" (math (date +%s) - $time) > $stderr else - printf "$indicator Aye! Fisherman is up to date\n" $time > $stderr + printf "Aye! Fisherman is up to date\n" $time > $stderr end - set items (fisher_list --enabled) + set items $enabled end for item in $items - debug "Validate %s" $item + if not contains -- $item $enabled + printf "fisher: I couldn't find '%s'\n" $item > $stderr + continue + end 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 plugin\n" $item > $stderr + debug "validate fail %s" $item continue end set -l path (__fisher_path_from_plugin $item) if test -z "$path" - printf "fisher: Plugin '%s' is not installed.\n" $item > $stderr + printf "fisher: I could not find '%s'\n" $item > $stderr continue end - debug "Validate ok %s" $item - set plugins $plugins $path + debug "validate ok %s" $item end set -l time (date +%s) @@ -94,21 +96,22 @@ function fisher_update -d "Update plugins" if set -q plugins[1] if test "$total" -gt 0 - printf "$indicator Updating %d plugin/s\n" $total > $stderr + printf "Updating %d plugin/s\n" $total > $stderr end for path in $plugins set -l name (printf "%s\n" $path | __fisher_name) if test ! -L $path - debug "Update start %s" "$name" + debug "update %s" "$name" + fish -ic " spin ' if set -l ahead (__fisher_path_update $path) set fisher_updated_plugins \$fisher_updated_plugins $name - printf \" %-22s %-10s\n\" \"$name\" \"\$ahead new commit/s\" + printf \" %-22s %-10s\n\" \"$name\" \"\$ahead new commit/s\" else - printf \" %-22s %-10s\n\" \"$name\" \"Up to date\" + printf \" %-22s %-10s\n\" \"$name\" \"Up to date\" end ' @@ -127,13 +130,13 @@ function fisher_update -d "Update plugins" set -l path (__fisher_path_from_plugin "$plugin") if __fisher_plugin_can_enable "$plugin" "$path" - debug "Enable %s" "$plugin" __fisher_plugin_enable "$plugin" "$path" + debug "enable %s" "$plugin" end end if test -z "$fisher_updated_plugins" - printf "No plugins were updated.\n" > $stdout + printf "No plugins were updated\n" > $stdout set -e fisher_updated_plugins return end @@ -141,13 +144,14 @@ function fisher_update -d "Update plugins" set time (math (date +%s) - $time) - printf "%d plugin/s updated in %0.fs\n" (count $fisher_updated_plugins) $time > $stdout - set -e fisher_updated_plugins + if test ! -z "$fisher_updated_plugins" -a "$fisher_updated_plugins" -ne 0 + printf "%d plugin/s up to date (%0.fs)\n" (count $fisher_updated_plugins) $time > $stdout - debug "Reset completions and key bindings start" + set -e fisher_updated_plugins - __fisher_complete_reset - __fisher_key_bindings_reset + __fisher_complete_reset + __fisher_key_bindings_reset - debug "Reset completions and key bindings ok" + debug "complete and key binds reset" + end end diff --git a/man/man1/fisher-install.1 b/man/man1/fisher-install.1 index baf6de9..e4611ba 100644 --- a/man/man1/fisher-install.1 +++ b/man/man1/fisher-install.1 @@ -145,7 +145,7 @@ Install plugins from multiple sources\. . .nf -fisher install fishtape simnalamburt/shellder ~/plugins/my_plugin +fisher install fishtape superman ~/plugins/my_plugin . .fi . @@ -155,4 +155,3 @@ fisher install fishtape simnalamburt/shellder ~/plugins/my_plugin fisher help uninstall . .br - diff --git a/man/man1/fisher-install.md b/man/man1/fisher-install.md index ce6b96b..f672075 100644 --- a/man/man1/fisher-install.md +++ b/man/man1/fisher-install.md @@ -3,7 +3,7 @@ fisher-install(1) -- Install plugins ## SYNOPSIS -fisher install [*plugins* ...] [--force] [--quiet] [--help] +fisher install [*plugins* ...] [--quiet] [--help] ## USAGE @@ -11,11 +11,10 @@ fisher install *url*
fisher install *name*
fisher install *path*
fisher install *owner/repo*
-fisher install *function*
## DESCRIPTION -Install one or more plugins, by name, URL, path or function name. If no arguments are given, read the standard input. +Install one or more plugins. If no arguments are given, read the standard input. In addition, all of the following owner/repo variations are accepted: @@ -39,9 +38,6 @@ If a plugin includes either a fish_prompt.fish or fish_right_prompt.fish, both f ## OPTIONS -* -f, --force: - Reinstall given plugin/s. - * -q, --quiet: Enable quiet mode. @@ -93,7 +89,7 @@ Snippets are plugins that run code at the start of the shell. Snippets must be p * Install plugins from multiple sources. ```fish -fisher install fishtape simnalamburt/shellder ~/plugins/my_plugin +fisher install fishtape superman ~/plugins/my_plugin ``` ## SEE ALSO diff --git a/man/man1/fisher-list.1 b/man/man1/fisher-list.1 index 517505f..53854b8 100644 --- a/man/man1/fisher-list.1 +++ b/man/man1/fisher-list.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "FISHER\-LIST" "1" "February 2016" "" "fisherman" +.TH "FISHER\-LIST" "1" "March 2016" "" "fisherman" . .SH "NAME" \fBfisher\-list\fR \- List installed plugins @@ -27,8 +27,8 @@ The list command displays all the plugins you have installed\. fisher list debug * fishtape -> shellder * spin +> superman @ wipe . .fi @@ -39,7 +39,7 @@ fisher list The legend consists of: . .P -\fB*\fR Indicate the plugin is currently installed +\fB*\fR Indicate the plugin is installed . .br \fB>\fR Indicate the plugin is a prompt diff --git a/man/man1/fisher-list.md b/man/man1/fisher-list.md index 58ccbc5..7ba68ff 100644 --- a/man/man1/fisher-list.md +++ b/man/man1/fisher-list.md @@ -4,7 +4,7 @@ fisher-list(1) -- List installed plugins ## SYNOPSIS fisher list [*file*]
-fisher list [--bare] [--link] [--enabled] [--disabled] [--help]
+fisher list [--enabled] [--disabled] [--help]
## USAGE @@ -12,39 +12,32 @@ fisher list [*file*] ## DESCRIPTION -The list command displays all the plugins you have installed. +The list command displays all the plugins that are currently installed. ``` fisher list debug -* fishtape -> shellder -* spin + fishtape + spin +> superman @ wipe ``` The legend consists of: -`*` Indicate the plugin is currently installed
`>` Indicate the plugin is a prompt
`@` Indicate the plugin is a symbolic link
## OPTIONS -* -b, --bare: - List plugin without decorators - -* -l, --link: - List plugins that are symbolic links - * --enabled: - List plugins that are enabled + List plugins that are enabled. * --disabled: - List plugins that are disabled + List plugins that are not installed, but available in the cache. * -h, --help: - Show usage help + Show usage help. ## SEE ALSO diff --git a/man/man1/fisher-search.1 b/man/man1/fisher-search.1 index e033c02..8f96466 100644 --- a/man/man1/fisher-search.1 +++ b/man/man1/fisher-search.1 @@ -53,7 +53,7 @@ fisher search fzf Efficient keybindings for fzf get Press any key to continue \.\.\. -> shellder Powerline prompt optimized for speed +> superman Powerline prompt based on Superman \.\.\. . .fi @@ -67,10 +67,10 @@ Get detailed information about a plugin\. . .nf -fisher search shellder -> shellder by simnalamburt -Powerline prompt optimized for speed -github\.com/simnalamburt/shellder +fisher search superman +> superman by bucaran +Powerline prompt based on Superman +github\.com/fishery/superman . .fi . @@ -224,4 +224,3 @@ fisher search \-\-name!~/^s/ .fi . .IP "" 0 - diff --git a/man/man1/fisher-search.md b/man/man1/fisher-search.md index 9cb926b..8ea94e1 100644 --- a/man/man1/fisher-search.md +++ b/man/man1/fisher-search.md @@ -30,17 +30,17 @@ fisher search fzf Efficient keybindings for fzf get Press any key to continue ... -> shellder Powerline prompt optimized for speed +> superman Powerline prompt based on Superman ... ``` Get detailed information about a plugin. ``` -fisher search shellder -> shellder by simnalamburt -Powerline prompt optimized for speed -github.com/simnalamburt/shellder +fisher search superman +> superman by bucaran +Powerline prompt based on Superman +github.com/fishery/superman ``` Search plugins using tags. diff --git a/man/man1/fisher-uninstall.md b/man/man1/fisher-uninstall.md index 210c106..0bb106e 100644 --- a/man/man1/fisher-uninstall.md +++ b/man/man1/fisher-uninstall.md @@ -15,11 +15,11 @@ fisher uninstall *owner/repo*
## DESCRIPTION -Uninstall one or more plugins, by name, URL or path. If no arguments are given, read the standard input. This process is the inverse of Install. +Uninstall one or more plugins. If no arguments are given, read the standard input. Uninstall does not remove any copies of the given plugin in $fisher_cache. To erase the copy from the cache, use the --force option. -Uninstall does not remove any dependencies installed with other plugins. This behavior prevents breaking plugins that share the same dependency. +Uninstall does not remove any dependencies installed with other plugins. ## OPTIONS @@ -34,10 +34,10 @@ Uninstall does not remove any dependencies installed with other plugins. This be ## EXAMPLES -* Uninstall all plugins and flush the cache. +* Uninstall all plugins flushing the cache. ```fish -fisher --list | fisher uninstall --force +fisher list | fisher uninstall --force ``` ## SEE ALSO diff --git a/man/man1/fisher-update.md b/man/man1/fisher-update.md index 78f432a..3ed0d13 100644 --- a/man/man1/fisher-update.md +++ b/man/man1/fisher-update.md @@ -14,9 +14,7 @@ fisher update *owner/repo* ...
## DESCRIPTION -Update one or more plugins, by name, URL or path. If no arguments are given, update Fisherman to the latest release. If you try to update a plugin that is currently disabled, but exists in the cache, it will be updated and then enabled. Use a dash `-` to read from the standard input. - -If a plugin is missing dependencies, they will be installed. If any dependencies are already installed they will not be updated. +Update one or more plugins concurrently. If no arguments are given, update everything, including Fisherman. Use a dash `-` to read from the standard input. ## OPTIONS @@ -39,9 +37,3 @@ fisher update ```fish fisher list | fisher update - ``` - -* Update all the plugins in the cache concurrently. - -```fish -fisher list --bare | xargs -n1 -P0 fish -c "fisher update -" -``` diff --git a/man/man1/fisher.1 b/man/man1/fisher.1 index 30f18d6..bbb37ca 100644 --- a/man/man1/fisher.1 +++ b/man/man1/fisher.1 @@ -203,7 +203,7 @@ List installed plugins\. fisher list debug * fishtape -> shellder +> superman * spin @ wipe . @@ -227,7 +227,7 @@ fisher search fzf Efficient keybindings for fzf get Press any key to continue \.\.\. -> shellder Powerline prompt optimized for speed +> superman Powerline prompt based on Superman \.\.\. . .fi diff --git a/man/man1/fisher.md b/man/man1/fisher.md index afe5b4e..44a008e 100644 --- a/man/man1/fisher.md +++ b/man/man1/fisher.md @@ -1,4 +1,4 @@ -fisher(1) -- Fish plugin manager +fisher(1) -- fish plugin manager ================================ ## SYNOPSIS @@ -9,7 +9,7 @@ fisher *command* [*options*] [--version] [--help]
Fisherman is a plugin manager for fish. -The Fisherman CLI consists of: *install*, *update*, *uninstall*, *list*, *search* and *help* and the following aliases: *i* for install, *u* for update, *l* for list, *s* for search and *h* for help. +The Fisherman CLI consists of: *install*, *update*, *uninstall*, *list*, *search* and *help* and the following aliases: *i* for install, *u* for update, *l* for list, *s* for search, *r* for uninstall and *h* for help. ## USAGE @@ -41,7 +41,7 @@ fisher help fisher i fishtape shark get bobthefish ``` -* Install Oh My Fish! plugins. +* Install oh-my-fish plugins. ```fish fisher i omf/plugin-{percol,jump,fasd} @@ -59,7 +59,7 @@ fisher i ./path/to/plugin fisher i https://github.com/some/plugin another/plugin bb:one/more ``` -* Install a plugin from a Gist. +* Install a plugin from a gist. ```fish fisher i gist.github.com/owner/1f40e1c6e0551b2666b2 @@ -98,10 +98,10 @@ List installed plugins. ``` fisher list debug -* fishtape -> shellder -* spin -@ wipe + fishtape + spin +> superman +@ my_aliases ``` Search the index. @@ -116,7 +116,7 @@ fisher search fzf Efficient keybindings for fzf get Press any key to continue ... -> shellder Powerline prompt optimized for speed +> superman Powerline prompt optimized for speed ... ``` @@ -138,19 +138,19 @@ Search using tags. fisher search --tag={git,test} ... * fishtape TAP producing test runner - git-branch-name Get the name of the current Git branch - git-is-dirty Test if there are changes not staged for commit - git-is-empty Test if a repository is empty - git-is-repo Test if the current directory is a Git repo - git-is-staged Test if there are changes staged for commit - git-is-stashed Test if there are changes in the stash - git-is-touched Test if there are changes in the working tree + git-branch-name Get the name of the current Git branch + git-is-dirty Test if there are changes not staged for commit + git-is-empty Test if a repository is empty + git-is-repo Test if the current directory is a Git repo + git-is-staged Test if there are changes staged for commit + git-is-stashed Test if there are changes in the stash + git-is-touched Test if there are changes in the working tree ... ``` The legend consists of: -* `*` The plugin is enabled +* `*` The plugin is installed * `>` The plugin is a prompt * `@` The plugin is a symbolic link diff --git a/test/deps-install.fish b/test/deps-install.fish deleted file mode 100644 index 86a20cb..0000000 --- a/test/deps-install.fish +++ /dev/null @@ -1,31 +0,0 @@ -set -l path $DIRNAME/.t-$TESTNAME-(random) - -function -S setup - mkdir -p $path $path/void - - printf "%s\n" foo bar > $path/bundle - printf "%s\n" baz norf > $path/fishfile - - function fisher_install - set -l count 0 - - while read -l plugin - set count (math $count + 1) - end - - echo "$count plugin/s installed." - end -end - -function -S teardown - rm -rf $path - functions -e fisher_install -end - -test "$TESTNAME - Install dependencies from one or more bundle/fishfile files" - (__fisher_deps_install $path ^ /dev/null) = 4 -end - -test "$TESTNAME - Print 0 to indicate no dependencies were installed" - (__fisher_deps_install $path/void) = 0 -end diff --git a/test/function-to-plugin.fish b/test/function-to-plugin.fish deleted file mode 100644 index 2ba0c97..0000000 --- a/test/function-to-plugin.fish +++ /dev/null @@ -1,31 +0,0 @@ -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 diff --git a/test/helpers/config-mock.fish b/test/helpers/config-mock.fish index f41b284..31fec02 100644 --- a/test/helpers/config-mock.fish +++ b/test/helpers/config-mock.fish @@ -1,5 +1,3 @@ -# Reset Fisherman's configuration state. - if functions -q debug functions -c debug debug_copy end @@ -20,10 +18,6 @@ set -g fisher_index file://$plugins/index __fisher_index_update -function -S __fisher_url_clone -a url path - cp -rf (echo $url | sed "s|https://github.com/|$plugins/|") $path -end - function spin eval $argv end diff --git a/test/install.fish b/test/install.fish index 766c845..e0b2bbb 100644 --- a/test/install.fish +++ b/test/install.fish @@ -5,9 +5,9 @@ function -S setup source $DIRNAME/helpers/config-mock.fish $path/config - fisher install foo bar --quiet --no-color - fisher install https://github.com/foobar --quiet --no-color - fisher install $DIRNAME/fixtures/plugins/baz --quiet --no-color + fisher install $DIRNAME/fixtures/plugins/{foo,bar} --quiet + fisher install $DIRNAME/fixtures/plugins/foobar --quiet + fisher install $DIRNAME/fixtures/plugins/baz --quiet end function -S teardown diff --git a/test/list.fish b/test/list.fish index cea4762..d2046b7 100644 --- a/test/list.fish +++ b/test/list.fish @@ -9,12 +9,6 @@ function -S setup printf "%s\n" foo bar baz theme > $path/fishfile set -g fisher_cache $path/cache - - # Fisherman uses the Fishfile to keep track of what plugins are currently installed - # so we need to create one in order to test all of fisher list=. - - # See also `list-fishfile.fish`. - set -g fisher_file $path/fishfile set -U fisher_prompt theme @@ -26,23 +20,18 @@ function -S teardown functions -e git end -test "$TESTNAME - Append > to active theme" - (fisher list | sed -n '/>.*/p') = "> theme" +test "$TESTNAME - Append @ to linked theme" + (fisher list | sed -n '/@.*/p') = "@ theme" end -test "$TESTNAME - Append * to active plugins" - (fisher list | sed -n '/\*.*/p' | xargs) = "* bar * baz * foo" +test "$TESTNAME - Indent plugins to match indent when links or prompts are installed" + (fisher list | sed -n '/ .*/p' | xargs) = "foo bar baz" end -test "$TESTNAME - Add one space indentation to disabled plugins to align with > and *" - (fisher list | sed '/^[\*>].*/d') = " norf" -end - -test "$TESTNAME - Do not add indentation when no plugins are enabled" - (rm $path/fishfile; fisher list) = ( - for plugin in foo bar baz norf theme - echo $plugin - end +test "$TESTNAME - Do not display disabled plugins" + -z ( + rm $path/fishfile + fisher list ) end diff --git a/test/uninstall.fish b/test/uninstall.fish index 88f65c2..1973951 100644 --- a/test/uninstall.fish +++ b/test/uninstall.fish @@ -5,7 +5,7 @@ function -S setup source $DIRNAME/helpers/config-mock.fish $path/config - fisher install foo bar foobar --quiet --no-color + fisher install $DIRNAME/fixtures/plugins/{foo,bar,foobar} --quiet fisher uninstall foo --quiet fisher uninstall foobar --quiet --force end