From 4b15cf374faf1bf817151ba6009826f79be62702 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Sat, 13 Feb 2016 20:37:49 +0900 Subject: [PATCH] Ahoy! We are getting close to 0.8.0 * Move AUTHORS -> THANKS and remove automatic generation. THANKS is more sensible than AUTHORS. CREDITS was second best. Also, after perusing similar files in other projects I noticed some entries lacking a valid email address and decided fow now this file should be curated manually to make sure each entry contains a useful link. This allows users who have contributed to the project ways other than committing code to be added to the list as well. * Rename wait -> spin. * Remove extra padding in links. (Cosmetic) * Update to reflect API refactorings. * Fix bug causing brackets to show up in description. * Implement using spin function. * __fisher_gist_to_name uses curl to query the GitHub API which will return a JSON stream even if the Gist could not be found. So, it's not possible to determine whether we failed or not using our spin function and actually need to check the returned string to see if it contains a valid name or not. * Let git pull write errors to stderr. * Use new internal __fisher_spin. * Extract spin to independent / external module and tweak Makefile to better integrate with new install process. --- .travis.yml | 2 +- AUTHORS.md | 6 - CHANGELOG.md | 29 ++-- Makefile | 53 ++----- README.md | 24 +-- THANKS.md | 12 ++ completions/fisher.fish | 10 +- completions/wait.fish | 8 - config.fish | 10 +- functions/__fisher_file.fish | 2 +- functions/__fisher_gist_to_name.fish | 12 +- functions/__fisher_help_parse.fish | 2 +- functions/__fisher_key_bindings.fish | 2 +- functions/__fisher_key_bindings_disable.fish | 10 +- functions/__fisher_key_bindings_enable.fish | 2 +- functions/__fisher_path_make.fish | 3 +- functions/__fisher_path_update.fish | 2 +- functions/__fisher_plugin_walk.fish | 6 +- functions/fisher_install.fish | 16 +- functions/fisher_search.fish | 2 +- functions/fisher_update.fish | 24 ++- functions/spin.fish | 3 + functions/wait.fish | 139 ------------------ man/man1/fisher.1 | 29 +--- man/man1/fisher.md | 11 +- man/man1/wait.1 | 105 ------------- man/man1/wait.md | 69 --------- man/man7/fisher-config.7 | 8 +- man/man7/fisher-config.md | 4 - man/man7/fisher-faq.7 | 2 +- man/man7/fisher-faq.md | 2 +- man/man7/fisher-tour.7 | 5 +- man/man7/fisher-tour.md | 4 +- test/config.fish | 2 +- .../update/key_bindings_function.fish | 2 +- test/gist-to-name.fish | 10 +- test/helpers/config-mock-teardown.fish | 2 +- test/helpers/config-mock.fish | 2 +- test/key-bindings-disable.fish | 2 +- test/key-bindings-enable.fish | 6 +- test/key-bindings-update.fish | 2 +- test/key-bindings.fish | 4 +- test/search.fish | 6 +- test/update.fish | 6 +- test/wait.fish | 21 --- 45 files changed, 139 insertions(+), 544 deletions(-) delete mode 100644 AUTHORS.md create mode 100644 THANKS.md delete mode 100644 completions/wait.fish create mode 100644 functions/spin.fish delete mode 100644 functions/wait.fish delete mode 100644 man/man1/wait.1 delete mode 100644 man/man1/wait.md delete mode 100644 test/wait.fish diff --git a/.travis.yml b/.travis.yml index fd29abc..7d3291f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,4 @@ before_install: - sudo apt-get update - sudo apt-get -y install fish script: - - make && fish -c "fisher install fishtape; fishtape test/*.fish" + - make && fish -c "__fisher_index_update; fisher_install fishtape; fishtape test/*.fish" diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index 36409d3..0000000 --- a/AUTHORS.md +++ /dev/null @@ -1,6 +0,0 @@ -# Authors -* Jorge Bucaran <[j@bucaran.me](mailto:j@bucaran.me)> -* Daniel Perez <[daniel@claudetech.com](mailto:daniel@claudetech.com)> -* Daniele Sluijters <[daenney@users.noreply.github.com](mailto:daenney@users.noreply.github.com)> -* Hyeon Kim <[simnalamburt@gmail.com](mailto:simnalamburt@gmail.com)> -* Kevin Ballard <[kevin@sb.org](mailto:kevin@sb.org)> diff --git a/CHANGELOG.md b/CHANGELOG.md index 794809b..2ac6e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## [0.8.0][v080] - 2016-02-15 + +* Add new **debug** mode enabled by setting a new `$fisher_debug` global / universal variable. For advanced logging and color options, install: [`fish_debug`](https://github.com/fishery/debug). + + ```fish + fisher install debug + ``` + +This mode makes commands behave verbosely and forces Fisherman to log all kinds of diagnostic information as well as run some simple health checks. + +* Several updates to the [website][http://fisherman.sh]. Changed to using the new SVG logo. More appeal using grammar tweaks. Drop some hardly ever used favicons and switch from SourceCodePro to Monaco style monospace fonts that load faster and cause less pollution. + +* Renamed core function `wait` to `spin` to reflect usage more accurately and updated its usage across Fisherman accordingly. + +* Renamed `$fisher_key_bindings` variable to `$fisher_binds` because it's shorter to type and makes `config.fish` look neater. + ## [0.7.0][v070] - 2016-02-11 * Welcome aboard @daenney, the newest Fisherman organization member. If you want to be part of the organization just let [me](https://github.com/bucaran) or @daenney know. @@ -28,7 +44,7 @@ * Tweak validate regex to correctly handle plugins that could be named `bb`, `gh`, `gl` or `omf`. -* **wait.fish** Add a single " " space after spinner by default. To remove the white space use a format like `--format="@\r"`. +* **spin.fish** Add a single " " space after spinner by default. To remove the white space use a format like `--format="@\r"`. * Supress unwated error message when the cache is empty. Closes #66. @@ -36,7 +52,6 @@ * Create empty fishfile during make install. - ## [0.5.0][v050] - 2016-02-02 * **Add user key bindings support.** (See #42). @@ -69,7 +84,6 @@ + Improve Install/Uninstall/Update status output. If a plugin fails to install decrease the total. If any plugins are skipped because they are already installed in the case of `fisher install` or available in the cache, but disabled in the case of `fisher uninstall` they are collected into an array and displayed in a new section `n plugin/s skipped (a, b, c)` at the bottom of the report. - * **Improve test coverage.** + Tightly coupled functions were making testing increasingly difficult. Most of the test effort was basically testing whether `git clone` or `git pull`. New separation of concerns makes tests run faster and the difficult install/uninstall algorithms has better coverage now. @@ -92,7 +106,6 @@ + Prepend `*` to plugin names to indicate they are currently enabled when using `fisher --list[=cache]`. See #49. - ## [0.4.0][v040] - 2016-01-11 * Introducing Fisherman's official website, hosted by GitHub pages. @@ -144,7 +157,6 @@ * :warning: Remove `fisher --cache` and `fisher --validate`. Now, that these options are separated into their own function and they are intentionally private, there is no need for them. - ## [0.3.0][v030] - 2016-01-08 > This release contains several breaking changes a few major improvements. The good news is that the API is starting to look more stable and very unlikely to change drastically again in the future. @@ -157,7 +169,7 @@ * Fix a bug in install, update and uninstall that was displaying an incorrect plugin count if there was at least on failure. -* Fix bug in `fisher install` that causes install to fail even though it succeeds, due to `wait(1)`'s behavior of returning `1` if there is any output to standard error. See #20. +* Fix bug in `fisher install` that causes install to fail even though it succeeds, due to `spin(1)`'s behavior of returning `1` if there is any output to standard error. See #20. * Fix bug in `fisher uninstall` that was removing plugins from the cache by mistake. @@ -209,7 +221,6 @@ * Revert #3. The reason `getopts.fish` was in its own file originally is because @bucaran wanted a standalone, dependency free cli parser solution, arguably slightly faster than having Awk read `getopts.awk` for each use. The performance improvement is negligible at best, but `getopts` is also used by every single command and future commands and plugins are very likely to use it as well, so we might as well use the slightly faster version. - ## [0.2.0][v020] - 2016-01-05 * Improve README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors. @@ -238,14 +249,10 @@ * Refactor and improve tests for `install`, `update` and `uninstall`. - ## [0.1.0][v010] - 2016-01-01 * Initial commit. - -:anchor: - [v100]: https://github.com/fisherman/fisherman/releases/tag/1.0.0 diff --git a/Makefile b/Makefile index 2042f6f..b112901 100644 --- a/Makefile +++ b/Makefile @@ -15,69 +15,48 @@ MAN7 := $(wildcard $(MAN)/man7/*.md) DOCS := $(MAN1:%.md=%.1) $(MAN5:%.md=%.5) $(MAN7:%.md=%.7) INDEX := $(FISHER_CACHE)/.index - -AUTHORS = $(FISHER_HOME)/AUTHORS.md VERSION = `cat $(FISHER_HOME)/VERSION` -MSG = printf "\033[47m\033[30m%s\033[0m\n" $(1) -TILDEIFY = sed "s|$$HOME|~|" - .PHONY: all test flush uninstall release -all: $(FISH_CONFIG) $(FISHER_CACHE) $(FISHER_FILE) $(AUTHORS) $(DOCS) - @if [ ! -s $(INDEX) ]; then\ - echo "Downloading the index for the first time...";\ - fish -c "__fisher_index_update 0";\ - fi - @$(call MSG,"Ahoy! Reset your shell and type 'fisher '") - @fish -c "fisher help -a" | sed -n '3,$$p' +all: $(FISH_CONFIG) $(FISHER_CACHE) $(FISHER_FILE) $(DOCS) + @echo "** Reload your shell and type 'fisher' to get started **" test: - @fish -c "fishtape test/*.fish" - -flush: - @rm -rf $(FISHER_CONFIG)/* + fish -c "fishtape test/*.fish" uninstall: - @echo "Removing configuration from $(FISH_CONFIG)" | $(TILDEIFY) - @sed -E '/set (fisher_home|fisher_config) /d;/source \$$fisher_home/d' \ + sed -E '/set (fisher_home|fisher_config) /d;/source \$$fisher_home/d' \ $(FISH_CONFIG) > $(FISH_CONFIG).tmp - @mv $(FISH_CONFIG).tmp $(FISH_CONFIG) - @$(call MSG,"Reset your shell to apply changes.") + mv $(FISH_CONFIG).tmp $(FISH_CONFIG) + $(call MSG,"Reload your shell to apply changes.") release: $(FISHER_HOME) - @if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\ + if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\ echo "`git -C $^ describe --abbrev=0 2>/dev/null || echo \*` -> $(VERSION)";\ sed "s/latest-v.\..\..-00B9FF/latest-v$(VERSION)-00B9FF/" $^/README.md > $^/README.md.swap;\ mv $^/README.md.swap $^/README.md;\ git -C $^ add README.md;\ git -C $^ add $^/VERSION;\ git -C $^ commit --quiet -m $(VERSION);\ - git -C $^ tag $(VERSION) -m v$(VERSION) --force >/dev/null;\ + git -C $^ tag $(VERSION) -m v$(VERSION) --force > /dev/null;\ else\ echo "Commit changes and update VERSION to tag a new release.";\ fi $(FISH_CONFIG): - @echo "Adding configuration to $@" | $(TILDEIFY) - @mkdir -p $(dir $@) && touch $@ - @echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher - @echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher - @echo "source \$$fisher_home/config.fish" >> $@.fisher - @awk 'FNR==NR{ print; a[$$0]; next } !($$0 in a) || /^$$/' $@.fisher $@ > $@.tmp - @mv $@.tmp $@ && rm $@.fisher + mkdir -p $(dir $@) && touch $@ + echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher + echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher + echo "source \$$fisher_home/config.fish" >> $@.fisher + awk 'FNR==NR{ print; a[$$0]; next } !($$0 in a) || /^$$/' $@.fisher $@ > $@.tmp + mv $@.tmp $@ && rm $@.fisher $(FISHER_CACHE): - @[ -d $@ ] || echo "Creating $@" | $(TILDEIFY) - @mkdir -p $@ + mkdir -p $@ $(FISHER_FILE): - @touch $@ - -$(AUTHORS): $(FISHER_HOME) - @echo "# Authors" > $@ - @git -C $^ shortlog -sne | cut -f2- | \ - sed -E 's/([^<>]+)<([^<>]*)>/* \1 \<[\2](mailto:\2)\>/' >> $@ + touch $@ %.1 %.5 %.7: %.md -@if type ronn 2>/dev/null 1>&2; then \ diff --git a/README.md b/README.md index 62afbaf..d8b4ae3 100644 --- a/README.md +++ b/README.md @@ -51,24 +51,24 @@ For documentation and guides [see the wiki][wiki]. For questions and feedback jo -[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.7.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 +[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.7.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 -[fish]: https://github.com/fish-shell/fish-shell -[quickstart]: https://github.com/fisherman/fisherman/wiki/Quickstart-Guide +[fish]: https://github.com/fish-shell/fish-shell +[quickstart]: https://github.com/fisherman/fisherman/wiki/Quickstart-Guide -[fundle]: https://github.com/tuvistavie/fundle/blob/master/functions/fundle.fish#L232 -[performance]: https://github.com/fisherman/fisherman/wiki/Performance +[fundle]: https://github.com/tuvistavie/fundle/blob/master/functions/fundle.fish#L232 +[performance]: https://github.com/fisherman/fisherman/wiki/Performance -[wiki]: https://github.com/fisherman/fisherman/wiki -[issues]: http://github.com/fisherman/fisherman/issues +[wiki]: https://github.com/fisherman/fisherman/wiki +[issues]: http://github.com/fisherman/fisherman/issues diff --git a/THANKS.md b/THANKS.md new file mode 100644 index 0000000..919c73e --- /dev/null +++ b/THANKS.md @@ -0,0 +1,12 @@ +# Thank You + +The following individuals have contributed to Fisherman. + +* Daniel Perez @tuvistavie +* Daniele Sluijters @daenney +* Hyeon Kim @simnalamburt +* Ian @ViViDboarder +* Jorge Bucaran @bucaran +* Kevin Ballard @kballard + +:heart: diff --git a/completions/fisher.fish b/completions/fisher.fish index 1bafa44..f95aca7 100644 --- a/completions/fisher.fish +++ b/completions/fisher.fish @@ -4,6 +4,8 @@ complete -c fisher -n "__fish_use_subcommand" -s l -l list -d "List plugins enab complete -c fisher -n "__fish_use_subcommand" -s h -l help -d "Display help" complete -c fisher -n "__fish_use_subcommand" -s v -l version -d "Show version information" +complete -c fisher -a "fisherman" -d "Update Fisherman" -n "__fish_seen_subcommand_from update" + complete -c fisher -a "\t" -n "__fish_seen_subcommand_from search" complete -c fisher -l "name" -d "Filter by name" -n "__fish_seen_subcommand_from search" complete -c fisher -l "url" -d "Filter by url" -n "__fish_seen_subcommand_from search" @@ -25,6 +27,10 @@ for option in commands guides end end +if test ! -e $fisher_cache/.index + exit +end + set -l plugins ( if test -s $fisher_file __fisher_file < $fisher_file | __fisher_name @@ -32,7 +38,6 @@ set -l plugins ( ) begin - awk -F '\n' -v RS='' -v OFS=';' '/^ *#/ { next } { print $1, $3 }' $fisher_cache/.index __fisher_cache_list @@ -43,7 +48,4 @@ end | sort -ut ';' -k1,1 | while read -l name info else complete -c fisher -n "__fish_seen_subcommand_from i install" -a "$name" -d "$info" end - end - -complete -c fisher -n "__fish_seen_subcommand_from update" -a "fisherman" -d "Update Fisherman" diff --git a/completions/wait.fish b/completions/wait.fish deleted file mode 100644 index 4d598e3..0000000 --- a/completions/wait.fish +++ /dev/null @@ -1,8 +0,0 @@ -set -l IFS \t - -complete -xc wait -n "__fish_seen_subcommand_from --spin" \ - -a "spinners arc star pipe ball flip mixer caret bar1 bar2 bar3" - -complete -xc wait -n "not __fish_seen_subcommand_from --spin" -a "\t" - -wait -h | __fisher_complete wait diff --git a/config.fish b/config.fish index 6a0d51a..8b4ee29 100644 --- a/config.fish +++ b/config.fish @@ -1,9 +1,9 @@ -set -g fisher_file $fisher_config/fishfile -set -g fisher_cache $fisher_config/cache -set -g fisher_key_bindings $fisher_config/key_bindings.fish +set -g fisher_file $fisher_config/fishfile +set -g fisher_cache $fisher_config/cache +set -g fisher_binds $fisher_config/key_bindings.fish -set -g fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path -set -g fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path +set -g fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path +set -g fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path for file in $fisher_config/conf.d/*.fish source $file diff --git a/functions/__fisher_file.fish b/functions/__fisher_file.fish index 28668bd..cef7adf 100644 --- a/functions/__fisher_file.fish +++ b/functions/__fisher_file.fish @@ -13,7 +13,7 @@ function __fisher_file } !/^[ \t]*(#.*)*$/ { - gsub("^[|*>]|#.*", "") + gsub("^[@*>]|#.*", "") if (! seen[$1]++) { printf("%s\n", $1) diff --git a/functions/__fisher_gist_to_name.fish b/functions/__fisher_gist_to_name.fish index 004a784..da9733e 100644 --- a/functions/__fisher_gist_to_name.fish +++ b/functions/__fisher_gist_to_name.fish @@ -1,13 +1,8 @@ function __fisher_gist_to_name -a url - if test -z "$url" - return 1 - end - - set -l id (printf "%s\n" $url | sed 's|.*/||') - set -l gists https://api.github.com/gists + set -l id (printf "%s\n" "$url" | sed 's|.*/||') set -l name ( - curl -s $gists/$id | awk ' + spin "curl -Ss https://api.github.com/gists/$id" | awk ' /"files": / { files++ } @@ -15,8 +10,7 @@ function __fisher_gist_to_name -a url gsub("^ *\"|\.fish.*", "") print } - - ' ^ /dev/null + ' ) if test -z "$name" diff --git a/functions/__fisher_help_parse.fish b/functions/__fisher_help_parse.fish index fcbf610..68b89fc 100644 --- a/functions/__fisher_help_parse.fish +++ b/functions/__fisher_help_parse.fish @@ -1,3 +1,3 @@ function __fisher_help_parse - sed -nE 's/^ *(-(.))?,? *--([^ =]+) *(.*)$/\4;\3;\2/p' + sed -nE 's/^ *(-(.))?,? *--([^ =[]+) *(.*)$/\4;\3;\2/p' end diff --git a/functions/__fisher_key_bindings.fish b/functions/__fisher_key_bindings.fish index f6adcb7..1a9206b 100644 --- a/functions/__fisher_key_bindings.fish +++ b/functions/__fisher_key_bindings.fish @@ -1,3 +1,3 @@ function __fisher_key_bindings - source $fisher_key_bindings ^ /dev/null + source $fisher_binds ^ /dev/null end diff --git a/functions/__fisher_key_bindings_disable.fish b/functions/__fisher_key_bindings_disable.fish index ca1ecba..4720a04 100644 --- a/functions/__fisher_key_bindings_disable.fish +++ b/functions/__fisher_key_bindings_disable.fish @@ -1,15 +1,15 @@ function __fisher_key_bindings_disable -a plugin user_key_bindings - fish_indent < $fisher_key_bindings \ + fish_indent < $fisher_binds \ | __fisher_key_bindings_undo $plugin \ | source __fisher_key_bindings_delete $plugin \ - > $fisher_key_bindings.tmp \ - < $fisher_key_bindings + > $fisher_binds.tmp \ + < $fisher_binds - command mv -f $fisher_key_bindings.tmp $fisher_key_bindings + command mv -f $fisher_binds.tmp $fisher_binds - if test ! -s $fisher_key_bindings + if test ! -s $fisher_binds sed -i.tmp '/__fisher_key_bindings/d' $user_key_bindings command rm -f $user_key_bindings.tmp end diff --git a/functions/__fisher_key_bindings_enable.fish b/functions/__fisher_key_bindings_enable.fish index 570ca40..0cae247 100644 --- a/functions/__fisher_key_bindings_enable.fish +++ b/functions/__fisher_key_bindings_enable.fish @@ -1,5 +1,5 @@ function __fisher_key_bindings_enable -a plugin user_key_bindings - __fisher_key_bindings_update $plugin >> $fisher_key_bindings + __fisher_key_bindings_update $plugin >> $fisher_binds if test ! -s $user_key_bindings command mkdir -p (dirname $user_key_bindings) diff --git a/functions/__fisher_path_make.fish b/functions/__fisher_path_make.fish index df8166c..b1b5899 100644 --- a/functions/__fisher_path_make.fish +++ b/functions/__fisher_path_make.fish @@ -3,11 +3,12 @@ function __fisher_path_make -a path pushd $path set -e argv[1] - + if not make $argv popd return 1 end + popd end end diff --git a/functions/__fisher_path_update.fish b/functions/__fisher_path_update.fish index 14eda9f..254c543 100644 --- a/functions/__fisher_path_update.fish +++ b/functions/__fisher_path_update.fish @@ -1,4 +1,4 @@ function __fisher_path_update -a path git -C $path checkout master --quiet ^ /dev/null - git -C $path pull --rebase origin master --quiet ^ /dev/null + git -C $path pull --rebase origin master --quiet end diff --git a/functions/__fisher_plugin_walk.fish b/functions/__fisher_plugin_walk.fish index 5b95581..cf69d3d 100644 --- a/functions/__fisher_plugin_walk.fish +++ b/functions/__fisher_plugin_walk.fish @@ -7,13 +7,13 @@ function __fisher_plugin_walk -a plugin path case \*/{fish_user_,}key_bindings.fish printf "%s %s %s\n" --bind $file - case \?\*/uninstall.fish + case \*/uninstall.fish printf "%s %s\n" --uninstall $file - case \?\*/completions/\*.fish + case \*/completions/\*.fish printf "%s %s %s\n" --source $file completions/$base - case \?\*/{conf.d,modules}/\?\* \?\*/\*config.fish \?\*/{before.,}init.fish \*/$plugin.load + case \*/{conf.d,modules}/\?\* \*/\*config.fish \*/{before.,}init.fish \*/$plugin.load switch "$base" case \*$plugin\* case \* diff --git a/functions/fisher_install.fish b/functions/fisher_install.fish index 1427b95..2eefb04 100644 --- a/functions/fisher_install.fish +++ b/functions/fisher_install.fish @@ -53,11 +53,11 @@ function fisher_install -d "Install Plugins" switch "$item" case https://gist.github.com\* - if set -l name (wait "__fisher_gist_to_name $item") + if set -l name (__fisher_gist_to_name $item) printf "%s %s\n" $item $name else set total (math $total - 1) - printf "fisher: '%s' is not a valid Gist or URL.\n" $item > $stderr + printf "fisher: Repository '%s' not found.\n" $item > $stderr end case \*/\* @@ -105,14 +105,7 @@ function fisher_install -d "Install Plugins" if test -d "$url" command ln -sfF $url $path - else if not wait "__fisher_url_clone $url $path" - printf "fisher: Repository not found: '%s'\n" $url > $stderr - - switch "$url" - case \*oh-my-fish\* - printf "Did you miss a 'plugin-' or 'theme-' prefix?\n" > $stderr - end - + else if not spin "__fisher_url_clone $url $path" --error=$stderr continue end end @@ -120,7 +113,8 @@ function fisher_install -d "Install Plugins" set -l deps (__fisher_deps_install "$path") if not __fisher_path_make "$path" --quiet - printf "fisher: Failed to build '%s'. See '%s/Makefile'.\n" $name $path > $stderr + set total (math $total - 1) + continue end __fisher_plugin_enable "$name" "$path" diff --git a/functions/fisher_search.fish b/functions/fisher_search.fish index 143c075..2a0612e 100644 --- a/functions/fisher_search.fish +++ b/functions/fisher_search.fish @@ -87,7 +87,7 @@ function fisher_search -d "Search Plugins" end if test $fisher_last_update -gt $fisher_update_interval -o ! -f $index - if wait "__fisher_index_update" + if spin "__fisher_index_update" --error=/dev/null __fisher_complete_reset end end diff --git a/functions/fisher_update.fish b/functions/fisher_update.fish index 0f60b13..bd51c26 100644 --- a/functions/fisher_update.fish +++ b/functions/fisher_update.fish @@ -36,21 +36,17 @@ function fisher_update -d "Update Plugins/Fisherman" printf "Updating >> Fisherman\n" > $stderr - if not wait "__fisher_index_update; __fisher_path_update $fisher_home" + if not spin " + __fisher_index_update 0 + __fisher_path_update $fisher_home" --error=$stderr + + ### + ### + printf "fisher: Arrr! Could not update Fisherman.\n" > $stderr - sed -E 's/.*error: (.*)/\1/' $fisher_cache/.debug > $stderr return 1 end - ############################# - ## Remove before 1.0 - set -g fisher_file $fisher_config/fishfile - if test ! -e $fisher_file - touch $fisher_file - end - ## Remove before 1.0 - ############################# - printf "Aye! Fisherman updated to version %s (%0.fs)\n" ( cat $fisher_home/VERSION) (math (date +%s) - $time) > $stderr @@ -92,10 +88,8 @@ function fisher_update -d "Update Plugins/Fisherman" set index (math $index + 1) end - if not wait "__fisher_path_update $path" --log=$fisher_cache/.debug - if test ! -L $path - sed -nE 's/.*(error|fatal): (.*)/error: \2/p - ' $fisher_cache/.debug > $stderr + if test ! -L $path + if not spin "__fisher_path_update $path" --error=$stderr continue end end diff --git a/functions/spin.fish b/functions/spin.fish new file mode 100644 index 0000000..fd7069e --- /dev/null +++ b/functions/spin.fish @@ -0,0 +1,3 @@ +function spin -a commands + fish -c "$commands" ^ /dev/stderr +end diff --git a/functions/wait.fish b/functions/wait.fish deleted file mode 100644 index 96c6c16..0000000 --- a/functions/wait.fish +++ /dev/null @@ -1,139 +0,0 @@ -function wait -d "Run commands and display a spinner" - set -l log - set -l time 0.02 - set -l option - set -l commands - set -l spinners - set -l format " @\r" - - getopts $argv | while read -l 1 2 - switch "$1" - case _ - set commands $commands ";$2" - - case s spin - set spinners $spinners $2 - - case t time - set time $2 - - case l log - set log $2 - - case f format - set format $2 - - case help - set option help - - case h - printf "usage: wait [--spin=