Merge pull request #30 from fisherman/v030

Ahoy! Fisherman 0.3.0
This commit is contained in:
Jorge Bucaran 2016-01-08 08:48:29 +09:00
commit 8bfdf82171
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30
52 changed files with 700 additions and 461 deletions

View file

@ -1,2 +1,3 @@
# Authors # Authors
* Jorge Bucaran <[j@bucaran.me](mailto:j@bucaran.me)> * Jorge Bucaran <[j@bucaran.me](mailto:j@bucaran.me)>
* Hyeon Kim <[simnalamburt@gmail.com](mailto:simnalamburt@gmail.com)>

View file

@ -1,25 +1,92 @@
# Change Log # Change Log
* [0.3.0](#030)
* [0.2.0](#020) * [0.2.0](#020)
* [0.1.0](#010) * [0.1.0](#010)
## 0.2.0 - 2016-01-05
* Improved README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors. ## [0.3.0][v030] - 2016-01-05
* :warning: Removed `fisher update --cache` in favor of `fisher --cache | fisher update` and `fisher uninstall --all` in favor of `fisher --cache | fisher uninstall`. > 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.
### Fixes
* Fix a critical bug in the Makefile that was incorrectly merging any existing user configuration file and the generated Fisherman configuration. Closes #21.
* Fix a bug in install and uninstall that was adding plugin names to fishfiles instead of the URL when interacting with custom URLs. Probably closes #23.
* 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. Closes #20.
* Fix bug in `fisher uninstall` that was removing plugins from the cache by mistake.
### Add
* Add feature to Makefile to download the index for the first time in order to provide auto-complete before the user can install/update/search, actions which would case the index to be updated.
* Add link to Slack [room][wharf] in README. Thanks @simnalamburt.
* Add new `$fisher_timeout` configuration variable that lets you specify `curl(1)` `--max-time` option. Without this, `curl` could hang for a long time if you are in a bad connection.
* Add `fisher install --link` to allow installing plugins creating a symbolic link to each of the relevant files to be copied during the install process. If you use ***`--link`*** to install a plugin that is a _path to a directory_ or file, a symbolic link to the directory will be created making local testing more convenient as you are not required to update the plugin's repository to test changes within Fisherman. If you are testing using [Fishtape][fishtape] you do not even need to reset the shell session.
* Add `fisher --alias[=<command>=<alias>]` to simplify creating new aliases for `fisher` commands. Use `fisher --alias` without arguments to list the current set of aliases. Also add auto-complete for aliases to install, update or uninstall. Note that aliases are **not** persisted this way. To save your aliases use `$fisher_alias` as described in `fisher help config`. Also note that aliases are only auto-complete if you call `fisher --alias`. To auto-complete aliases saved to `$fisher_alias` you can do `fisher --alias (fisher --alias)`.
* Add short options for new and old fisher flags:
* `--file``-f`
* `--list``-l`
* `--alias``-a`
### Improvements
* Improve help message for failed installs. Closes ##24. @namandistro
* Improve `fisher --validate` to automatically correct common misspellings, for example when installing a oh-my-fish package, one often types ohmyifsh.
* :point_up: Improve auto-complete performance by extracting the implementation of the different `fisher` flags to `__fisher_*` functions. `completions/fisher.fish` relies heavily in `fisher_search` to query what plugins are available to install/update/uninstall. In this process, numerous calls to `fisher --list` and `fisher --validate`, etc., are made. Now, auto-complete does not have to pay the penalty of entering `fisher`, parsing options, etc. Closes #27. @namandistro
* Improve `fisher --help` output and show up until now poorly documented ***`--list`***, ***`--file`***, etc. flags consistently. Also display available commands after `make install` to improve usability.
* Improve `fisher install` so that it checks whether the plugin you are trying to install, if it is already in the cache, is a symbolic link or not, and installs it as if the `--link` flag was specified.
* Improve `fisher --validate` to retrieve the absolute path to the closest directory of the given items if they are valid local paths. Related #19.
* Improve install to not `git clone` local plugins if a regular `path/to/file` is given to `fisher install`. Instead, copy to the cache using `cp(1)` and if `--link` is used, create a symlink.
* Improve `fisher --validate` to invalidate items with repeated `.` and `-` and allow items that begin with `/` or `./` to support installing plugins from local paths. Related #19.
## :warning: Remove / Rename
* Modify `fisher update` default behavior. Now this command updates Fisherman by default. Use of `--self` and `--me` is also **deprecated**. To read from the standard input use a dash `-`. For example: `fisher --list | fisher update -`. See [Usage of dash in place of a filename](http://unix.stackexchange.com/questions/16357/usage-of-dash-in-place-of-a-filename/16364#16364). Closes #25.
* Rename `--cache` to more descriptive ***`--list`***. Thanks @colstrom.
* Remove `fisher --cache=base` and make it return the base names of all directories in the path by default. To get the full path use printf `printf "$fisher_cache/%s" (fisher --list)`
* Rename undocumented `fisher --translate` flag (again) to `fisher --cache`. This function reads the standard input for a name, URL or local path and calculates the plugin's path relative to the cache. For a name this is simple `$fisher_cache/<name>` for an URL, retrieve the remote URL of every repository until there is a match with the given URL and return the path in the cache of that repository. Finally, if the input is a
* 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.
* :warning: Remove `fisher update --cache` in favor of `fisher --list | fisher update` and `fisher uninstall --all` in favor of `fisher --list | fisher uninstall`.
* :warning: Fisherman does not move initialization / configuration files following the convention `name`.config.fish to `$fisher_config/functions`, but to `$fisher_config/conf.d` now and evaluates each `*.config.fish` inside at shell start as usual. Closes #13. * :warning: Fisherman does not move initialization / configuration files following the convention `name`.config.fish to `$fisher_config/functions`, but to `$fisher_config/conf.d` now and evaluates each `*.config.fish` inside at shell start as usual. Closes #13.
* Added `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`. Closes #11. * ~~Add `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`~~. Closes #11.
* Fisherman now generates information about plugins installed via custom URLs. For the description, a shortened version of the URL is used. For the URL the full URL is used. For tags, the URL is fuzzily checked and tags such as _theme_, _plugin_, _config_ and _omf_ are added. The tag _orphan_ is added by default as well. Finally, the author is generated by retrieving the e-mail or username of the author of the first commit in the plugin's repository. Closes #9 and #14. * Fisherman now generates information about plugins installed via custom URLs. For the description, a shortened version of the URL is used. For the URL the full URL is used. For tags, the URL is fuzzily checked and tags such as _theme_, _plugin_, _config_ and _omf_ are added. The tag _orphan_ is added by default as well. Finally, the author is generated by retrieving the e-mail or username of the author of the first commit in the plugin's repository. Closes #9 and #14.
* Changed `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8. * ~~Change `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8.~~
* Fixed a bug with `mktemp` failing on some systems. Closes #7. Thanks @tobywf. * Fix a bug where `mktemp` would fail in some systems. Closes #7. Thanks @tobywf.
* Added [CODE_OF_CONDUCT][code_of_conduct]. Closes #6. * Add [CODE_OF_CONDUCT][code_of_conduct]. Closes #6.
* Fisherman can now unload themes within the same shell, without having to restart the session. Closes #5. * Fisherman can now unload themes within the same shell, without having to restart the session. Closes #5.
@ -29,7 +96,8 @@
* Support dots inside URIs in `fisher --validate`. Closes #2. * Support dots inside URIs in `fisher --validate`. Closes #2.
* Refactored and improved tests for `install`, `update` and `uninstall`. * Refactor and improve tests for `install`, `update` and `uninstall`.
## [0.1.0][v010] - 2016-01-01 ## [0.1.0][v010] - 2016-01-01
@ -40,6 +108,16 @@
<!-- Links --> <!-- Links -->
[v030]: https://
[v020]: https://github.com/fisherman/fisherman/commit/54212e1cbce66c7671baa045653efe912dbb4b77
[v010]: https://github.com/fisherman/fisherman/commit/3386ed052ae4a84338c340d37b98c1742f8a45f6 [v010]: https://github.com/fisherman/fisherman/commit/3386ed052ae4a84338c340d37b98c1742f8a45f6
[bobthefish-19]: https://github.com/oh-my-fish/theme-bobthefish/pull/19 [bobthefish-19]: https://github.com/oh-my-fish/theme-bobthefish/pull/19
[code_of_conduct]: CODE_OF_CONDUCT.md [code_of_conduct]: CODE_OF_CONDUCT.md
[fishtape]: https://github.com/fisherman/fishtape
[wharf]: http://fisherman-wharf.herokuapp.com/

View file

@ -13,6 +13,8 @@ MAN5 := $(wildcard $(MAN)/man5/*.md)
MAN7 := $(wildcard $(MAN)/man7/*.md) MAN7 := $(wildcard $(MAN)/man7/*.md)
DOCS := $(MAN1:%.md=%.1) $(MAN5:%.md=%.5) $(MAN7:%.md=%.7) DOCS := $(MAN1:%.md=%.1) $(MAN5:%.md=%.5) $(MAN7:%.md=%.7)
INDEX := $(FISHER_CACHE)/.index
AUTHORS = $(FISHER_HOME)/AUTHORS.md AUTHORS = $(FISHER_HOME)/AUTHORS.md
VERSION = `cat $(FISHER_HOME)/VERSION` VERSION = `cat $(FISHER_HOME)/VERSION`
@ -22,7 +24,12 @@ TILDEIFY = sed "s|$$HOME|~|"
.PHONY: all test flush uninstall release .PHONY: all test flush uninstall release
all: $(FISH_CONFIG) $(FISHER_CACHE) $(AUTHORS) $(DOCS) all: $(FISH_CONFIG) $(FISHER_CACHE) $(AUTHORS) $(DOCS)
@$(call MSG,"Reset your shell to apply changes") @if [ ! -s $(INDEX) ]; then\
echo "Downloading the index for the first time...";\
fish -c "fisher_update --index";\
fi
@$(call MSG,"Reset your shell and type 'fisher <command>' to use Fisherman.")
@fish -c "fisher -h" | sed -n '5,$$p'
test: test:
@fish -c "fishtape test/*.fish" @fish -c "fishtape test/*.fish"
@ -35,7 +42,7 @@ uninstall:
@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 $(FISH_CONFIG) > $(FISH_CONFIG).tmp
@mv $(FISH_CONFIG).tmp $(FISH_CONFIG) @mv $(FISH_CONFIG).tmp $(FISH_CONFIG)
@$(call MSG,"Reset your shell to apply changes") @$(call MSG,"Reset your shell to apply changes.")
release: $(FISHER_HOME) release: $(FISHER_HOME)
@if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\ @if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\
@ -56,7 +63,7 @@ $(FISH_CONFIG):
@echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher @echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher
@echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher @echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher
@echo "source \$$fisher_home/config.fish" >> $@.fisher @echo "source \$$fisher_home/config.fish" >> $@.fisher
@awk '!config[$$0]++ || /^$$/' $@.fisher $@ > $@.tmp @awk 'FNR==NR{ print; a[$$0]; next } !($$0 in a) || /^$$/' $@.fisher $@ > $@.tmp
@mv $@.tmp $@ && rm $@.fisher @mv $@.tmp $@ && rm $@.fisher
$(FISHER_CACHE): $(FISHER_CACHE):
@ -69,4 +76,5 @@ $(AUTHORS): $(FISHER_HOME)
sed -E 's/([^<>]+)<([^<>]*)>/* \1 \&lt;[\2](mailto:\2)\&gt;/' >> $@ sed -E 's/([^<>]+)<([^<>]*)>/* \1 \&lt;[\2](mailto:\2)\&gt;/' >> $@
%.1 %.5 %.7: %.md %.1 %.5 %.7: %.md
@ronn --manual=fisherman --roff $? 2>&1 | sed 's/^ *roff: *//;s|//|/|g' @echo "Creating the documentation..."
-@ronn --manual=fisherman --roff $? 1>&2 2> /dev/null

View file

@ -52,4 +52,4 @@ See [`fisherman(1)`][fisherman-1] and [`fisherman(7)`][fisherman-7] for usage an
[fisherman-7]: man/man7/fisher.md [fisherman-7]: man/man7/fisher.md
[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
[fisherman-version]: https://img.shields.io/badge/fisherman-v0.2.0-00B9FF.svg?style=flat-square [fisherman-version]: https://img.shields.io/badge/fisherman-v0.3.0-00B9FF.svg?style=flat-square

View file

@ -1 +1 @@
0.2.0 0.3.0

View file

@ -3,12 +3,13 @@ complete -c fisher -n "__fish_seen_subcommand_from search" -a "\t"
complete -c fisher -n "__fish_use_subcommand" -s v -l version -d "Show version information" complete -c fisher -n "__fish_use_subcommand" -s v -l version -d "Show version information"
complete -c fisher -n "__fish_use_subcommand" -s h -l help -d "Display help" complete -c fisher -n "__fish_use_subcommand" -s h -l help -d "Display help"
complete -c fisher -n "__fish_use_subcommand" -s f -l file -d "Read fishfile" complete -c fisher -n "__fish_use_subcommand" -s f -l file -d "Read fishfile"
complete -c fisher -n "__fish_use_subcommand" -s a -l alias -d "Define one or more comma-separated command aliases"
complete -c fisher -n "__fish_use_subcommand" -s l -l list -d "List plugins in the cache"
set -l index $fisher_cache/.index
set -l IFS ";" set -l IFS ";"
for option in commands guides for option in commands guides
fisher help --$option=bare | sed -E 's/^ *([^ ]+) *(.*)/\1;\2/' | while read -l func info fisher_help --$option=bare | sed -E 's/^ *([^ ]+) *(.*)/\1;\2/' | while read -l func info
complete -c fisher -n "__fish_seen_subcommand_from help" -a $func -d "$info" complete -c fisher -n "__fish_seen_subcommand_from help" -a $func -d "$info"
@ -18,20 +19,13 @@ for option in commands guides
complete -c fisher -n "__fish_use_subcommand" -a $func -d "$info" complete -c fisher -n "__fish_use_subcommand" -a $func -d "$info"
fisher_help --usage=$func | __fish_parse_usage OFS=';' | while read -l 1 2 3 fisher_help --usage=$func | __fisher_complete OFS=';' | while read -l 1 2 3
complete -c fisher -n "__fish_seen_subcommand_from $func" -s "$3" -l "$2" -d "$1" complete -c fisher -n "__fish_seen_subcommand_from $func" -s "$3" -l "$2" -d "$1"
end end
end end
end end
if test -e $fisher_cache/.index if test -e $fisher_cache/.index
fisher search --index=$index --select=cache --name --info | while read -l name info __fisher_complete_cache update uninstall
for command in update uninstall __fisher_complete_remote install
complete -c fisher -n "__fish_seen_subcommand_from $command" -a "$name" -d "$info"
end
end
fisher search --index=$index --select=remote --name --info | while read -l name info
complete -c fisher -n "__fish_seen_subcommand_from install" -a "$name" -d "$info"
end
end end

View file

@ -5,6 +5,6 @@ complete -xc wait -d "Run commands and wait with a spin"
complete -xc wait -n "not __fish_seen_subcommand_from --spin" -a "\t" complete -xc wait -n "not __fish_seen_subcommand_from --spin" -a "\t"
set -l IFS \t set -l IFS \t
wait --help | __fish_parse_usage | while read -l 1 2 3 wait --help | __fisher_complete | while read -l 1 2 3
complete -c wait -s "$3" -l "$2" -d "$1" complete -c wait -s "$3" -l "$2" -d "$1"
end end

View file

@ -3,6 +3,8 @@ set fisher_index https://raw.githubusercontent.com/fisherman/fisher-index/master
set fisher_error_log $fisher_cache/.debug_log set fisher_error_log $fisher_cache/.debug_log
set fisher_timeout 5
set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path
set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path

View file

@ -0,0 +1,35 @@
function __fisher_alias -a value -d "Define one or more comma-separated command aliases."
switch "$value"
case ""
if test -z "$fisher_alias"
return 1
end
printf "%s\n" $fisher_alias | sed 's/[=,]/ /g'
case \*
for value in $argv
if contains -- $fisher_alias $value
continue
end
set -g fisher_alias $fisher_alias $value
set -l index $fisher_cache/.index
if not test -e $index
continue
end
for alias in (__fisher_alias)
switch $alias
case install\*
__fisher_complete_remote $alias
case update\* uninstall\*
__fisher_complete_cache $alias
end
end
end
end
end

View file

@ -0,0 +1,20 @@
function __fisher_cache -d "Calculate path of a name, url or path relative to the cache"
while read --prompt="" -l item
switch "$item"
case file:///\*
printf "%s\n" $item
case \*/\*
for file in $fisher_cache/*
switch "$item"
case (git -C $file ls-remote --get-url | __fisher_validate)
printf "%s\n" $file
break
end
end
case \*
printf "%s\n" $fisher_cache/$item
end
end
end

View file

@ -1,17 +1,13 @@
function __fish_parse_usage -d "Parse usage help output" # Usage
switch "$argv[1]" # __fisher_complete [awk_var=value] [--help]
case -h --help #
printf "Usage\n" # Example
printf " __fish_parse_usage [awk_var=value] [--help]\n\n" # set -l IFS \t
# STDIN | __fisher_complete | while read -l d l s
printf "Example\n" # complete -c <command> -s -l -d
printf " set -l IFS \\\t\n" # end
printf " STDIN | __fish_parse_usage | while read -l d l s\n"
printf " complete -c <command> -s $s -l $l -d $d\n"
printf " end\n"
return
end
function __fisher_complete -d "Parse usage help output"
switch "$argv" switch "$argv"
case \*OFS=\* case \*OFS=\*
case \* case \*

View file

@ -0,0 +1,7 @@
function __fisher_complete_cache -d "Add auto-complete for cached plugins"
set -l IFS ";"
fisher_search --index=$fisher_cache/.index --select=cache --name --info \
| while read -l name info
complete -c fisher -n "__fish_seen_subcommand_from $argv" -a "$name" -d "$info"
end
end

View file

@ -0,0 +1,7 @@
function __fisher_complete_remote -d "Add auto-complete for remote plugins"
set -l IFS ";"
fisher_search --index=$fisher_cache/.index --select=remote --name --info \
| while read -l name info
complete -c fisher -n "__fish_seen_subcommand_from $argv" -a "$name" -d "$info"
end
end

View file

@ -0,0 +1,19 @@
function __fisher_file -a file -d "Read a fishfile and display its contents"
switch "$file"
case ""
set file $fisher_config/fishfile
case "-"
set file /dev/stdin
end
awk '
!/^ *(#.*)*$/ {
gsub("#.*", "")
if (/^ *package .+/) $1 = $2
if (!duplicates[$1]++) printf("%s\n", $1)
}
' $file
end

View file

@ -0,0 +1,7 @@
function __fisher_list -d "List plugins in the cache"
for file in $fisher_cache/*
if test -d $file
basename $file
end
end
end

View file

@ -0,0 +1,3 @@
function __fisher_name -d "Generate a pretty name from a plugin path or URL"
sed -E 's|.*/(.*)|\1|; s/^(plugin|theme|pkg|omf|fish|fisher)-//'
end

View file

@ -0,0 +1,43 @@
function __fisher_validate -d "Validate a name, url or path"
set -l id "[A-Za-z0-9_]+([.-]?[A-Za-z0-9_])*"
if not set -q fisher_default_host
set fisher_default_host https://github.com
end
while read -lp "" item
switch "$item"
case \*..\* /. /
continue
end
if test -e "$item"
if test $item = $HOME
continue
end
if test -f "$item"
set item (dirname $item)
end
if not printf "%s\n" $item | grep "^\/"
printf "$PWD/%s/%s" (dirname $item) (basename $item)
end | sed -E 's|^/|file:///|;s|[./]*$||'
else
printf "%s\n" $item | sed -En "
s#plg?ug?i?n#plugin#
s#oh?my?i?f[iy]?h?si?h?#oh-my-fish#
s#/\$##
s#\.git\$##
s#^(https?):*/* *(.*\$)#\1://\2#p
s#^(@|(gh[:/])|(github(.com)?[/:]))/?($id)/($id)\$#https://github.com/\5/\7#p
s#^(bb[:/])/*($id)/($id)\$#https://bitbucket.org/\2/\4#p
s#^(gl[:/])/*($id)/($id)\$#https://gitlab.com/\2/\4#p
s#^(omf[:/])/*($id)\$#https://github.com/oh-my-fish/\2#p
s#^($id)/($id)\$#$fisher_default_host/\1/\3#p
/^file:\/\/\/.*/p
/^[a-z]+([._-]?[a-z0-9]+)*\$/p"
end
end
end

View file

@ -1,4 +1,4 @@
function fisher -d "Fish plugin manager" function fisher -d "Fish Shell Plugin Manager"
if not set -q argv[1] if not set -q argv[1]
fisher --help fisher --help
return 1 return 1
@ -7,6 +7,7 @@ function fisher -d "Fish plugin manager"
set -l option set -l option
set -l value set -l value
set -l quiet -E . set -l quiet -E .
set -l alias
getopts $argv | while read -l 1 2 getopts $argv | while read -l 1 2
switch "$1" switch "$1"
@ -15,17 +16,19 @@ function fisher -d "Fish plugin manager"
set value $2 set value $2
break break
case a alias
set option alias
set alias $alias $2
case h help case h help
set option help set option help
set value $value $2 set value $value $2
case cache case l list
set option cache set option list
set value $2
case translate case c cache
set option translate set option cache
set value $2
case f file case f file
set option file set option file
@ -33,7 +36,9 @@ function fisher -d "Fish plugin manager"
case V validate case V validate
set option validate set option validate
set value $2
case name
set option translate
case v version case v version
set option version set option version
@ -42,7 +47,7 @@ function fisher -d "Fish plugin manager"
set quiet -q . set quiet -q .
case \* case \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher --help >& 2 fisher --help >& 2
return 1 return 1
end end
@ -50,7 +55,7 @@ function fisher -d "Fish plugin manager"
switch "$option" switch "$option"
case command case command
printf "%s\n" $fisher_alias | sed 's/[=,]/ /g' | while read -la alias __fisher_alias | while read -la alias
if set -q alias[2] if set -q alias[2]
switch "$value" switch "$value"
case $alias[2..-1] case $alias[2..-1]
@ -73,81 +78,22 @@ function fisher -d "Fish plugin manager"
end end
case validate case validate
if not test -z "$value" __fisher_validate | grep $quiet
printf "%s\n" $value | fisher --validate | grep $quiet
return
end
if not set -q fisher_default_host case list
set fisher_default_host https://github.com __fisher_list
end
set -l id "[A-Za-z0-9_.-]"
sed -En "
s#/\$##
s#\.git\$##
s#^(https?):*/* *(.*\$)#\1://\2#p
s#^(@|(gh[:/])|(github(.com)?[/:]))/?($id+)/($id+)\$#https://github.com/\5/\6#p
s#^(bb[:/])/*($id+)/($id+)\$#https://bitbucket.org/\2/\3#p
s#^(gl[:/])/*($id+)/($id+)\$#https://gitlab.com/\2/\3#p
s#^(omf[:/])/*($id+)\$#https://github.com/oh-my-fish/\2#p
s#^($id+)/($id+)\$#$fisher_default_host/\1/\2#p
/^file:\/\/\/.*/p
/^[a-z]+([._-]?[a-z0-9]+)*\$/p
" | grep $quiet
case cache case cache
for file in $fisher_cache/* __fisher_cache
if test -d $file
switch "$value"
case base
basename $file
case \*
printf "%s\n" $file
end
end
end
case translate
while read --prompt="" -l item
switch "$item"
case \*/\*
for file in $fisher_cache/*
switch "$item"
case (git -C $file ls-remote --get-url | fisher --validate)
printf "%s\n" $file
break
end
end
case \*
printf "%s\n" $fisher_cache/$item
end
end
case file case file
switch "$value" __fisher_file "$value"
case "-"
set value /dev/stdin
case ""
set value $fisher_config/fishfile
end
awk ' case alias
!/^ *(#.*)*$/ { __fisher_alias $alias
gsub("#.*", "")
if (/^ *package .+/) { case name
$1 = $2 __fisher_name
}
if (!k[$1]++) {
printf("%s\n", $1)
}
}
' $value
case version case version
sed 's/^/fisher version /;q' $fisher_home/VERSION sed 's/^/fisher version /;q' $fisher_home/VERSION
@ -157,18 +103,20 @@ function fisher -d "Fish plugin manager"
set value commands set value commands
end end
printf "usage: fisher <command> [<options>] [--version] [--help]\n\n" printf "usage: fisher [--version] [--help] [--list] [--quiet]\n"
printf " [-a <command>=alias[,...]] [-f <path>]\n"
printf " <command> [<options>]\n\n"
switch commands switch commands
case $value case $value
printf "Available Fisherman commands:\n" printf "Available Commands:\n"
fisher_help --commands=bare fisher_help --commands=bare
echo echo
end end
switch guides switch guides
case $value case $value
printf "Available Fisherman guides:\n" printf "Other Documentation:\n"
fisher_help --guides=bare fisher_help --guides=bare
echo echo
end end

View file

@ -30,17 +30,16 @@ function fisher_help -d "Display Help Information"
set value $value $2 set value $value $2
case h help case h help
printf "usage: fisher help [<keyword>] [--all] [--guides]\n" printf "usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
printf " [--usage[=<command>]] [--help]\n\n"
printf " -a --all List commands and guides \n" printf " -a --all List available documentation \n"
printf " -g --guides List documentation guides \n" printf " -g --guides List available guides \n"
printf " -u --usage[=<command>] Display command usage help \n" printf " -u --usage[=<cmd>] Display command usage help \n"
printf " -h --help Show usage help \n" printf " -h --help Show usage help \n"
return return
case \* case \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher_help --help >& 2 fisher_help --help >& 2
return 1 return 1
end end

View file

@ -1,5 +1,6 @@
function fisher_install -d "Enable / Install Plugins" function fisher_install -d "Enable / Install one or more plugins"
set -l items set -l items
set -l option
set -l error /dev/stderr set -l error /dev/stderr
getopts $argv | while read -l 1 2 getopts $argv | while read -l 1 2
@ -7,41 +8,45 @@ function fisher_install -d "Enable / Install Plugins"
case _ case _
set items $items $2 set items $items $2
case s l link
set option link
case q quiet case q quiet
set error /dev/null set error /dev/null
case h help case h help
printf "usage: fisher install [<name or url> ...] [--quiet] [--help]\n\n" printf "usage: fisher install [<name or url> ...] [--link] [--quiet]\n"
printf " [--help]\n\n"
printf " -s --link Install as symbolic links\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 \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher_install --help >& 2 fisher_install --help >& 2
return 1 return 1
end end
end end
set -l count 0 set -l count 0
set -l total (count $items) set -l index 1
set -l elapsed (date +%s) set -l elapsed (date +%s)
set -l total (count $items)
if set -q items[1] if set -q items[1]
printf "%s\n" $items printf "%s\n" $items
else else
fisher --file=- __fisher_file -
end | fisher --validate | while read -l item end | __fisher_validate | while read -l item
switch "$item" switch "$item"
case \*/\* case \*/\*
printf "%s %s\n" $item ( printf "%s %s\n" $item (
if not fisher_search --url=$item --name if not fisher_search --url=$item --name
printf "%s" $item | sed -E ' printf "%s\n" $item | __fisher_name
s/.*\/(.*)/\1/
s/^(plugin|theme|pkg|omf|fish|fisher)-//'
end) end)
case \* case \*
@ -52,7 +57,7 @@ function fisher_install -d "Enable / Install Plugins"
printf "%s %s\n" (git -C $fisher_cache/$item ls-remote --get-url) $item printf "%s %s\n" (git -C $fisher_cache/$item ls-remote --get-url) $item
else else
printf "fisher: '%s' not found\n" $item > $error printf "fisher: '%s' path not found\n" $item > $error
end end
end end
@ -65,7 +70,9 @@ function fisher_install -d "Enable / Install Plugins"
printf ">> %s\n" $name > $error printf ">> %s\n" $name > $error
case \* case \*
printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error printf "(%s of %s) >> %s\n" $index $total $name > $error
set index (math $index + 1)
end end
mkdir -p $fisher_config/{cache,functions,completions,conf.d,man} mkdir -p $fisher_config/{cache,functions,completions,conf.d,man}
@ -73,14 +80,36 @@ function fisher_install -d "Enable / Install Plugins"
set -l path $fisher_cache/$name set -l path $fisher_cache/$name
if not test -e $path if not test -e $path
if not wait --spin=pipe --log=$fisher_error_log " switch "$url"
git clone --quiet --depth 1 $url $path" case file:///\*
set url (printf "%s\n" $url | sed 's|file://||')
printf "fisher: Repository not found: '%s'\n" $url > $error if test "$option" = link
continue ln -sF $url $path
else
cp -rf $url $path
end
case \*
if not wait --spin=pipe --log=$fisher_error_log "
git clone --quiet --depth 1 $url $path"
printf "fisher: Repository not found: '%s'\n" $url > $error
switch "$url"
case \*oh-my-fish\*
printf "Did you miss a 'plugin-' or 'theme-' prefix?\n" > $error
end
continue
end
end end
end end
if test -L $path
set option link
end
set -l bundle $path/fishfile set -l bundle $path/fishfile
if test -e $path/bundle if test -e $path/bundle
@ -90,7 +119,7 @@ function fisher_install -d "Enable / Install Plugins"
if test -e $bundle if test -e $bundle
printf "Resolving dependencies in %s\n" $name/(basename $bundle) > $error printf "Resolving dependencies in %s\n" $name/(basename $bundle) > $error
set -l deps (fisher --file=$bundle \ set -l deps (__fisher_file $bundle \
| fisher_install ^&1 \ | fisher_install ^&1 \
| sed -En 's/([0-9]+) plugin\/s.*/\1/p') | sed -En 's/([0-9]+) plugin\/s.*/\1/p')
@ -99,20 +128,20 @@ function fisher_install -d "Enable / Install Plugins"
if test -s $path/Makefile -o -s $path/makefile if test -s $path/Makefile -o -s $path/makefile
pushd $path pushd $path
if not make > /dev/null ^ $error if not make > /dev/null ^ $fisher_error_log
cat $fisher_error_log
popd popd
printf "fisher: Can't make '%s'\n" $name > $error
continue continue
end end
popd popd
end end
if test -e $path/fish_prompt.fish -o -e $path/fish_right_prompt.fish if test -e $path/fish_prompt.fish -o -e $path/fish_right_prompt.fish
rm -f $fisher_config/functions/{fish_prompt,fish_right_prompt}.fish rm -f $fisher_config/functions/fish_{,right_}prompt.fish
functions -e fish_{,right_}prompt functions -e fish_{,right_}prompt
end end
for file in $path/{*,functions{/*,/**/*}}.fish for file in $path/{*,functions{/*,/**}}.fish
set -l base (basename $file) set -l base (basename $file)
switch $base switch $base
@ -125,45 +154,70 @@ function fisher_install -d "Enable / Install Plugins"
switch $base switch $base
case \*\?.config.fish case \*\?.config.fish
cp -f $file $fisher_config/conf.d/$base if test "$option" = link
ln -sF $file $fisher_config/conf.d/$base
else
cp -f $file $fisher_config/conf.d/$base
end
case \* case \*
cp -f $file $fisher_config/functions/$base if test "$option" = link
ln -sF $file $fisher_config/functions/$base
else
cp -f $file $fisher_config/functions/$base
end
end end
end end
cp -f $path/completions/*.fish $fisher_config/completions/ ^ /dev/null if test "$option" = link
for file in $path/completions/*.fish
ln -sF $file $fisher_config/completions/(basename $file)
end
else
cp -f $path/completions/*.fish $fisher_config/completions/ ^ /dev/null
end
for n in (seq 9) for n in (seq 9)
if test -d $path/man/man$n if test -d $path/man/man$n
mkdir -p $fisher_config/man/man$n mkdir -p $fisher_config/man/man$n
end end
cp -f $path/man/man$n/*.$n $fisher_config/man/man$n/ ^ /dev/null
for file in $path/man/man$n/*.$n
if test "$option" = link
ln -sF $file $fisher_config/man/man$n
else
cp -f $file $fisher_config/man/man$n
end
end
end end
set count (math $count + 1) set count (math $count + 1)
set -l file $fisher_config/fishfile set -l file $fisher_config/fishfile
touch $file
set -l item $name
if fisher_search --name=$name --and --tag=orphan --quiet
set item $url
end
if test -s $file if test -s $file
if fisher --file=$file | grep -Eq "^$name\$|^$url\$" if __fisher_file $file | grep -Eq "^$item\$"
continue continue
end end
end end
touch $file printf "%s\n" "$item" >> $file
if not fisher_search --name=$name --field=name --quiet
set name $url
end
printf "%s\n" "$name" >> $file
end end
printf "%d plugin/s installed (%0.fs)\n" (math $count) ( set elapsed (math (date +%s) - $elapsed)
math (date +%s) - $elapsed) > $error
if not test $count -gt 0 if test "$count" = 0
printf "No plugins were installed.\n" > $error
return 1 return 1
end end
printf "Aye! %d plugin/s installed in %0.fs\n" $count $elapsed > $error
end end

View file

@ -15,7 +15,7 @@ function fisher_search -d "Search Fisherman Index"
case \*/\* case \*/\*
set 1 url set 1 url
set -l url (fisher --validate=$2) set -l url (printf "%s\n" $2 | __fisher_validate)
if not test -z "$url" if not test -z "$url"
set 2 $url set 2 $url
end end
@ -75,8 +75,8 @@ function fisher_search -d "Search Fisherman Index"
set quiet 1 set quiet 1
case h help case h help
printf "usage: fisher search [<name or url>] [--select=<source>] [--field=<field>]\n" printf "usage: fisher search [<name or url>] [--select=<source>] [--quiet]\n"
printf " [--or|--and] [--quiet] [--help]\n\n" printf " [--or|--and] [--field=<field>] [--help]\n\n"
printf " -s --select=<source> Select all, cache or remote plugins \n" printf " -s --select=<source> Select all, cache or remote plugins \n"
printf " -f --field=<field> Filter by name, url, info, tag or author \n" printf " -f --field=<field> Filter by name, url, info, tag or author \n"
@ -87,7 +87,7 @@ function fisher_search -d "Search Fisherman Index"
return return
case \* case \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher_search --help >& 2 fisher_search --help >& 2
return 1 return 1
end end
@ -117,7 +117,7 @@ function fisher_search -d "Search Fisherman Index"
return 1 return 1
end end
set -l cache (fisher --cache=base) set -l cache (__fisher_list)
awk -v FS='\n' -v RS='' -v cache_items="$cache" ' awk -v FS='\n' -v RS='' -v cache_items="$cache" '
BEGIN { BEGIN {
@ -159,7 +159,7 @@ function fisher_search -d "Search Fisherman Index"
set -l tags orphan set -l tags orphan
for tag in theme plugin oh-my-fish config for tag in theme plugin oh-my-fish config
if printf "%s" "$url" | grep -q $tag if printf "%s\n" "$url" | grep -q $tag
switch "$tag" switch "$tag"
case oh-my-fish case oh-my-fish
set tag omf set tag omf
@ -174,10 +174,10 @@ function fisher_search -d "Search Fisherman Index"
cat $index cat $index
case remote case remote
fisher_search --index=$index --and --name!=(fisher --cache=base) fisher_search --index=$index --and --name!=(__fisher_list)
case cache case cache
fisher --cache=base | read -laz cache __fisher_list | read -laz cache
if test -z "$cache" if test -z "$cache"
return 1 return 1

View file

@ -26,29 +26,35 @@ function fisher_uninstall -d "Disable / Uninstall Plugins"
return return
case \* case \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher_uninstall --help >& 2 fisher_uninstall --help >& 2
return 1 return 1
end end
end end
set -l count 0 set -l count 0
set -l duration (date +%s) set -l index 1
set -l total (count $items) set -l total (count $items)
set -l elapsed (date +%s)
if set -q items[1] if set -q items[1]
printf "%s\n" $items printf "%s\n" $items
else else
fisher --file=- __fisher_file -
end | __fisher_validate | __fisher_cache | while read -l path
end | fisher --validate | fisher --translate | while read -l path
if not test -d "$path" if not test -d "$path"
printf "fisher: '%s' not found\n" $path > $error switch "$path"
continue case file:///\*
set path (printf "%s\n" $path | sed 's|file://||')
case \*
printf "fisher: '%s' path not found\n" $path > $error
continue
end
end end
set -l name (basename $path) set -l name (printf "%s\n" $path | __fisher_name)
printf "Uninstalling " > $error printf "Uninstalling " > $error
@ -57,10 +63,10 @@ function fisher_uninstall -d "Disable / Uninstall Plugins"
printf ">> %s\n" $name > $error printf ">> %s\n" $name > $error
case \* case \*
printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error printf "(%s of %s) >> %s\n" (math 1 + $index) $total $name > $error
end
set count (math $count + 1) set index (math $index + 1)
end
for file in $path/{*,functions{/*,/**/*}}.fish for file in $path/{*,functions{/*,/**/*}}.fish
set -l base (basename $file) set -l base (basename $file)
@ -77,7 +83,7 @@ function fisher_uninstall -d "Disable / Uninstall Plugins"
set base $name.(basename $base .fish).config.fish set base $name.(basename $base .fish).config.fish
end end
rm -f $file $fisher_config/{functions,conf.d}/$base rm -f $fisher_config/{functions,conf.d}/$base
end end
for file in $path/completions/*.fish for file in $path/completions/*.fish
@ -92,16 +98,18 @@ function fisher_uninstall -d "Disable / Uninstall Plugins"
end end
end end
git -C $path ls-remote --get-url ^ /dev/null | fisher --validate | read -l url git -C $path ls-remote --get-url ^ /dev/null | __fisher_validate | read -l url
switch force switch force
case $option case $option
rm -rf $path rm -rf $path
end end
set count (math $count + 1)
set -l file $fisher_config/fishfile set -l file $fisher_config/fishfile
if not fisher --file=$file | grep -Eq "^$name\$|^$url\$" if not __fisher_file $file | grep -Eq "^$name\$|^$url\$"
continue continue
end end
@ -110,14 +118,19 @@ function fisher_uninstall -d "Disable / Uninstall Plugins"
if not sed -E '/^ *'(printf "%s|%s" $name $url | sed 's|/|\\\/|g' if not sed -E '/^ *'(printf "%s|%s" $name $url | sed 's|/|\\\/|g'
)'([ #].*)*$/d' < $file > $tmp )'([ #].*)*$/d' < $file > $tmp
rm -f $tmp rm -f $tmp
printf "fisher: can't delete '%s' from %s\n" $name $file > $error printf "fisher: Could not remove '%s' from %s\n" $name $file > $error
return 1 return 1
end end
mv -f $tmp $file mv -f $tmp $file
end end
printf "%d plugin/s uninstalled (%0.fs)\n" $count (math (date +%s) - $duration) > $error set elapsed (math (date +%s) - $elapsed)
test $count -gt 0 if test $count = 0
printf "No plugins were uninstalled.\n" > $error
return 1
end
printf "Aye! %d plugin/s uninstalled in %0.fs\n" > $error $count $elapsed
end end

View file

@ -1,12 +1,13 @@
function fisher_update -d "Fisherman Update Manager" function fisher_update -d "Fisherman Update Manager"
set -l option
set -l path set -l path
set -l items set -l items
set -l option self
set -l error /dev/stderr set -l error /dev/stderr
getopts $argv | while read -l 1 2 getopts $argv | while read -l 1 2
switch "$1" switch "$1"
case _ case - _
set option
set items $items $2 set items $items $2
case index case index
@ -16,31 +17,27 @@ function fisher_update -d "Fisherman Update Manager"
set option path set option path
set path $2 set path $2
case m me self fisher{,man}
set option $option me
case q quiet case q quiet
if test -z "$2"
set 2 /dev/null
end
set error $2 set error $2
case help h case help h
printf "usage: fisher update [<name or url> ...] [--me] [--quiet] [--help]\n\n" printf "usage: fisher update [<name or url> ...] [--quiet] [--help]\n\n"
printf " -m --me Update Fisherman\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 \*
printf "fisher: '%s' is not a valid option\n" $1 >& 2 printf "fisher: Ahoy! '%s' is not a valid option\n" $1 >& 2
fisher_update --help >& 2 fisher_update --help >& 2
return 1 return 1
end end
end end
if test -z "$error"
set error /dev/null
end
switch "$option" switch "$option"
case path case path
if not test -d $path if not test -d $path
@ -49,47 +46,64 @@ function fisher_update -d "Fisherman Update Manager"
end end
wait --spin=pipe --log=$fisher_error_log " wait --spin=pipe --log=$fisher_error_log "
git -C $path checkout --quiet master ^/dev/null git -C $path checkout --quiet master ^/dev/null
git -C $path pull --quiet --rebase origin master" git -C $path pull --quiet --rebase origin master
"
case index case index
mkdir -p $fisher_cache mkdir -p $fisher_cache
set -l index $fisher_cache/.index.tmp set -l index $fisher_cache/.index.tmp
if curl -s $fisher_index > $index if wait --spin=pipe --log=$fisher_error_log "
curl --max-time $fisher_timeout -sS $fisher_index > $index
"
mv -f $index $fisher_cache/.index mv -f $index $fisher_cache/.index
else
printf "fisher: Connection timeout. Try again.\n" > $error
end end
rm -f $index rm -f $index
case me case self
set -l elap (date +%s) set -l elapsed (date +%s)
printf "Updating >> Fisherman\n" > $error printf "Updating >> Fisherman\n" > $error
if not fisher_update --path=$fisher_home --quiet=$error if not fisher_update --path=$fisher_home --quiet=$error
printf "fisher: Could not update Fisherman.\n" > $error
sed -E 's/.*(error:.*)/\1/' $fisher_error_log > $error
return 1 return 1
end end
printf "Done without errors (%0.fs)\n" (math (date +%s) - $elap) > $error printf "Done without errors (%0.fs)\n" (
math (date +%s) - $elapsed) > $error
case \* case \*
set -l elap (date +%s)
set -l count 0 set -l count 0
set -l index 1
set -l total (count $items) set -l total (count $items)
set -l elapsed (date +%s)
if set -q items[1] if set -q items[1]
printf "%s\n" $items printf "%s\n" $items
else else
fisher --file=- __fisher_file -
end | fisher --validate | fisher --translate | while read -l path end | __fisher_validate | __fisher_cache | while read -l path
if not test -d "$path" if not test -d "$path"
printf "fisher: '%s' not found\n" $path > $error switch "$path"
continue case file:///\*
case \*
printf "fisher: '%s' path not found\n" $path > $error
continue
end
end end
set -l name (basename $path) set -l name (printf "%s\n" $path | __fisher_name)
printf "Updating " > $error printf "Updating " > $error
@ -98,21 +112,35 @@ function fisher_update -d "Fisherman Update Manager"
printf ">> %s\n" $name > $error printf ">> %s\n" $name > $error
case \* case \*
printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error printf "(%s of %s) >> %s\n" $index $total $name > $error
set index (math $index + 1)
end end
if not fisher_update --path=$path --quiet=$error switch "$path"
sed -nE 's/.*(error|fatal): (.*)/error: \2/p' $fisher_error_log > $error case file:///\*
continue case \*
if not test -L $path
if not fisher_update --path=$path --quiet=$error
sed -nE 's/.*(error|fatal): (.*)/error: \2/p
' $fisher_error_log > $error
continue
end
end
end end
fisher install $name --quiet fisher install --quiet -- (printf "%s\n" $name | __fisher_name)
set count (math $count + 1) set count (math $count + 1)
end end
printf "%d plugin/s updated (%0.fs)\n" $count (math (date +%s) - $elap) > $error set elapsed (math (date +%s) - $elapsed)
test $count -gt 0 if test $count = 0
printf "No plugins were updated.\n" > $error
return 1
end
printf "Aye! %d plugin/s updated in %0.fs\n" > $error $count $elapsed
end end
end end

View file

@ -4,7 +4,26 @@ function getopts -d "Parse CLI options"
end end
printf "%s\n" $argv | sed -E ' printf "%s\n" $argv | sed -E '
s/^-([A-Za-z]+)/- \1 / s/^-([A-Za-z]+)/- \1 /; s/^--([A-Za-z0-9_-]+)(!?)=?(.*)/-- \1 \3 \2 /' | awk '
s/^--([A-Za-z0-9_-]+)(!?)=?(.*)/-- \1 \3 \2 /' | \
awk -f $fisher_home/share/getopts.awk function out(k,v) { if (!seen[k v]++) print k (v == "" ? "" : " "v) }
function pop() { return len <= 0 ? "_" : opt[len--] }
!/^ *$/ {
if (done) out("_" , $1$2$3)
else if ($1 == "--" && !$2) done = 1
else if ($1 !~ /^-|^--/ ) out(pop(), $0)
else {
while (len) out(pop())
if ($3) for (i = 4; i <= NF; i++) $3 = $3" "$i
if ($1 == "--") if ($3 == "") opt[++len] = $2; else out($2, $3)
if ($1 == "-") {
if ($2 == "") { print $1; next } else n = split($2, keys, "")
if ($3 == "") opt[++len] = keys[n]; else out(keys[n], $3)
for (i = 1; i < n; i++) out(keys[i])
}
}
}
END { while (len) out(pop()) }
'
end end

View file

@ -101,7 +101,7 @@ function wait -d "Run commands and wait with a spin"
while true while true
if status --is-interactive if status --is-interactive
for i in $spinners for i in $spinners
printf "$format" | awk -v t=$time -v i=(printf "%s" $i | sed 's/=/\\\=/') ' printf "$format" | awk -v t=$time -v i=(printf "%s\n" $i | sed 's/=/\\\=/') '
{ {
system("tput civis") system("tput civis")
gsub("@", i) gsub("@", i)

View file

@ -7,7 +7,7 @@
\fBfisher\-install\fR \- Enable / Install plugins \fBfisher\-install\fR \- Enable / Install plugins
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
fisher \fBinstall\fR [\fIname\fR or \fIurl\fR \.\.\.] [\fB\-\-quiet\fR] [\fB\-\-help\fR] fisher \fBinstall\fR [\fIname\fR, \fIurl\fR or \fIpath\fR \.\.\.] [\fB\-\-link\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR]
. .
.SH "USAGE" .SH "USAGE"
fisher \fBinstall\fR \fIplugin\fR \.\.\. fisher \fBinstall\fR \fIplugin\fR \.\.\.
@ -16,12 +16,15 @@ fisher \fBinstall\fR \fIplugin\fR \.\.\.
fisher \fBinstall\fR \fIowner/repo\fR \.\.\. fisher \fBinstall\fR \fIowner/repo\fR \.\.\.
. .
.br .br
fisher \fBinstall\fR \fIpath\fR \.\.\.
.
.br
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Install one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, read the standard input\. Install one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, read the standard input\.
. .
.P .P
If the domain or host is not provided, Fisherman will use any value in \fB$fisher_default_host\fR\. The default is \fBhttps://github\.com\fR\. If the domain or host is not provided, Fisherman will use any value in \fB$fisher_default_host\fR\. The default value is \fBhttps://github\.com\fR\.
. .
.P .P
In addition, all of the following variations are accepted: In addition, all of the following variations are accepted:
@ -33,7 +36,7 @@ In addition, all of the following variations are accepted:
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBgh:\fRowner/repo \fB\->\fR https://github\.com/owner/repo \fBgh\fRowner/repo \fB\->\fR https://github\.com/owner/repo
. .
.br .br
@ -44,19 +47,19 @@ In addition, all of the following variations are accepted:
Shortcuts for other common Git repository hosting services are also available: Shortcuts for other common Git repository hosting services are also available:
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBbb:\fR/owner/repo \fB\->\fR https://bitbucket\.org/owner/repo \fBbb\fR/owner/repo \fB\->\fR https://bitbucket\.org/owner/repo
. .
.br .br
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBgl:\fR/owner/repo \fB\->\fR https://gitlab\.com/owner/repo \fBgl\fR/owner/repo \fB\->\fR https://gitlab\.com/owner/repo
. .
.br .br
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBomf:\fR/owner/repo \fB\->\fR https://github\.com/oh\-my\-fish/repo \fBomf\fR/owner/repo \fB\->\fR https://github\.com/oh\-my\-fish/repo
. .
.br .br
@ -64,7 +67,10 @@ Shortcuts for other common Git repository hosting services are also available:
.IP "" 0 .IP "" 0
. .
.P .P
If a copy of the plugin already exists in \fB$fisher_cache\fR, the relevant files will be copied to \fB$fisher_config\fR/functions, otherwise the plugin repository is first downloaded\. If you wish to update a plugin, use \fBfisher update\fR \fIplugin\fR instead\. If a copy of the plugin already exists in \fB$fisher_cache\fR, only the relevant files are copied to \fB$fisher_config\fR/functions, otherwise the plugin repository is first downloaded\. If you wish to update a plugin, use \fBfisher update\fR \fIplugin\fR instead\.
.
.P
If a local path is given, copy the directory to the cache\.
. .
.P .P
If the plugin declares dependencies, these will be installed as well\. If any dependencies are already installed they will not be updated in order to prevent version issues\. See \fBfisher help fishfile\fR#{\fBPlugins\fR}\. If the plugin declares dependencies, these will be installed as well\. If any dependencies are already installed they will not be updated in order to prevent version issues\. See \fBfisher help fishfile\fR#{\fBPlugins\fR}\.
@ -75,6 +81,10 @@ If a plugin includes either a fish_prompt\.fish or fish_right_prompt\.fish, both
.SH "OPTIONS" .SH "OPTIONS"
. .
.TP .TP
\fB\-s\fR \fB\-\-link\fR
Create a symbolic link to the plugin repository in the cache or to the original source directory if a local path is given\.
.
.TP
\fB\-q\fR \fB\-\-quiet\fR \fB\-q\fR \fB\-\-quiet\fR
Enable quiet mode\. Enable quiet mode\.
. .
@ -144,7 +154,7 @@ Here is the \fIplugin\fR tree inside the cache:
.br .br
. .
.P .P
And thisi is how the files are copied from \fB$fisher_cache\fR/plugin to \fB$fisher_config\fR: And this is how the files are copied from \fB$fisher_cache\fR/plugin to \fB$fisher_config\fR:
. .
.IP "1." 4 .IP "1." 4
\fIplugin\fR\.fish \fB\->\fR $fisher_config/functions \fIplugin\fR\.fish \fB\->\fR $fisher_config/functions

View file

@ -3,31 +3,34 @@ fisher-install(1) -- Enable / Install plugins
## SYNOPSIS ## SYNOPSIS
fisher `install` [*name* or *url* ...] [`--quiet`] [`--help`] fisher `install` [*name*, *url* or *path* ...] [`--link`] [`--quiet`] [`--help`]
## USAGE ## USAGE
fisher `install` *plugin* ...<br> fisher `install` *plugin* ...<br>
fisher `install` *owner/repo* ...<br> fisher `install` *owner/repo* ...<br>
fisher `install` *path* ...<br>
## DESCRIPTION ## DESCRIPTION
Install one or *more* plugins by *name*, searching `$fisher_index` or by *url*. If no arguments are given, read the standard input. Install one or *more* plugins by *name*, searching `$fisher_index` or by *url*. If no arguments are given, read the standard input.
If the domain or host is not provided, Fisherman will use any value in `$fisher_default_host`. The default is `https://github.com`. If the domain or host is not provided, Fisherman will use any value in `$fisher_default_host`. The default value is `https://github.com`.
In addition, all of the following variations are accepted: In addition, all of the following variations are accepted:
* `github`/owner/repo `->` https://github.com/owner/repo<br> * `github`/owner/repo `->` https://github.com/owner/repo<br>
* `gh:`owner/repo `->` https://github.com/owner/repo<br> * `gh`owner/repo `->` https://github.com/owner/repo<br>
Shortcuts for other common Git repository hosting services are also available: Shortcuts for other common Git repository hosting services are also available:
* `bb:`/owner/repo `->` https://bitbucket.org/owner/repo<br> * `bb`/owner/repo `->` https://bitbucket.org/owner/repo<br>
* `gl:`/owner/repo `->` https://gitlab.com/owner/repo<br> * `gl`/owner/repo `->` https://gitlab.com/owner/repo<br>
* `omf:`/owner/repo `->` https://github.com/oh-my-fish/repo<br> * `omf`/owner/repo `->` https://github.com/oh-my-fish/repo<br>
If a copy of the plugin already exists in `$fisher_cache`, the relevant files will be copied to `$fisher_config`/functions, otherwise the plugin repository is first downloaded. If you wish to update a plugin, use `fisher update` *plugin* instead. If a copy of the plugin already exists in `$fisher_cache`, only the relevant files are copied to `$fisher_config`/functions, otherwise the plugin repository is first downloaded. If you wish to update a plugin, use `fisher update` *plugin* instead.
If a local path is given, copy the directory to the cache.
If the plugin declares dependencies, these will be installed as well. If any dependencies are already installed they will not be updated in order to prevent version issues. See `fisher help fishfile`#{`Plugins`}. If the plugin declares dependencies, these will be installed as well. If any dependencies are already installed they will not be updated in order to prevent version issues. See `fisher help fishfile`#{`Plugins`}.
@ -35,6 +38,9 @@ If a plugin includes either a fish_prompt.fish or fish_right_prompt.fish, both f
## OPTIONS ## OPTIONS
* `-s` `--link`:
Create a symbolic link to the plugin repository in the cache or to the original source directory if a local path is given.
* `-q` `--quiet`: * `-q` `--quiet`:
Enable quiet mode. Enable quiet mode.
@ -68,7 +74,7 @@ Here is the *plugin* tree inside the cache:
|-- *plugin*.1<br> |-- *plugin*.1<br>
And thisi is how the files are copied from `$fisher_cache`/plugin to `$fisher_config`: And this is how the files are copied from `$fisher_cache`/plugin to `$fisher_config`:
1. *plugin*.fish `->` $fisher_config/functions 1. *plugin*.fish `->` $fisher_config/functions
2. functions/plugin_helper.fish `->` $fisher_config/functions 2. functions/plugin_helper.fish `->` $fisher_config/functions

View file

@ -83,7 +83,7 @@ Filter the result set by \fIfield\fR=\fImatch\fR, where \fIfield\fR can be one o
. .
.TP .TP
\-\-\fIfield\fR[~\fB/\fR\fIregex\fR\fB/\fR] \-\-\fIfield\fR[~\fB/\fR\fIregex\fR\fB/\fR]
Essentially the same as \-\-\fIfield\fR=\fImatch\fR, but with Regular Expression support\. \-\-\fIfield\fR~\fB/\fR\fIregex\fR\fB/\fR filters the result set using the given \fB/\fR\fIregex\fR\fB/\fR\. For example, \-\-name=\fB/\fR^\fImatch\fR$\fB/\fR is the same as \-\-\fIfield\fR=\fImatch\fR and \-\-url~\fB/\fRoh\-my\-fish\fB/\fR selects only Oh My Fish! plugins\. Use \fB!~\fR to negate the query\. Essentially the same as \-\-\fIfield\fR=\fImatch\fR, but with Regular Expression support\. \-\-\fIfield\fR~\fB/\fR\fIregex\fR\fB/\fR filters the result set using the given \fB/\fR\fIregex\fR\fB/\fR\. For example, \-\-name=\fB/\fR^\fImatch\fR$\fB/\fR is the same as \-\-\fIfield\fR=\fImatch\fR and \-\-url~\fB/\fRoh\-my\-fish\fB/\fR selects only oh-my-fish plugins\. Use \fB!~\fR to negate the query\.
. .
.TP .TP
\fB\-a\fR \fB\-\-and\fR \fB\-a\fR \fB\-\-and\fR

View file

@ -48,7 +48,7 @@ See #{`Output`} for more information.
Filter the result set by *field*=*match*, where *field* can be one or more of `name`, `url`, `info`, `tag` or `author`. If *match* is not given, this is equivalent to `--select`=*field*. Use `!=` to negate the query. Filter the result set by *field*=*match*, where *field* can be one or more of `name`, `url`, `info`, `tag` or `author`. If *match* is not given, this is equivalent to `--select`=*field*. Use `!=` to negate the query.
* --*field*[~`/`*regex*`/`]: * --*field*[~`/`*regex*`/`]:
Essentially the same as --*field*=*match*, but with Regular Expression support. --*field*~`/`*regex*`/` filters the result set using the given `/`*regex*`/`. For example, --name=`/`^*match*$`/` is the same as --*field*=*match* and --url~`/`oh-my-fish`/` selects only Oh My Fish! plugins. Use `!~` to negate the query. Essentially the same as --*field*=*match*, but with Regular Expression support. --*field*~`/`*regex*`/` filters the result set using the given `/`*regex*`/`. For example, --name=`/`^*match*$`/` is the same as --*field*=*match* and --url~`/`oh-my-fish`/` selects only oh-my-fish plugins. Use `!~` to negate the query.
* `-a` `--and`: * `-a` `--and`:
Join query with a logical AND operator. Join query with a logical AND operator.

View file

@ -7,7 +7,7 @@
\fBfisher\-uninstall\fR \- Disable / Uninstall Plugins \fBfisher\-uninstall\fR \- Disable / Uninstall Plugins
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
fisher \fBuninstall\fR [\fIname\fR or \fIurl\fR \.\.\.] fisher \fBuninstall\fR [\fIname\fR, \fIurl\fR or \fIpath\fR \.\.\.]
. .
.br .br
fisher \fBuninstall\fR [\fB\-\-force\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] fisher \fBuninstall\fR [\fB\-\-force\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR]
@ -21,6 +21,9 @@ fisher \fBuninstall\fR \fIplugin\fR \.\.\.
fisher \fBuninstall\fR \fIowner/repo\fR \.\.\. fisher \fBuninstall\fR \fIowner/repo\fR \.\.\.
. .
.br .br
fisher \fBuninstall\fR \fIpath\fR \.\.\.
.
.br
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Uninstall one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, read the standard input\. This process is the inverse of Install\. See \fBfisher help install\fR\. Uninstall one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, read the standard input\. This process is the inverse of Install\. See \fBfisher help install\fR\.
@ -56,7 +59,7 @@ Uninstall all plugins and flush the cache\.
. .
.nf .nf
fisher \-\-cache=base | fisher uninstall \-\-force fisher \-\-list | fisher uninstall \-\-force
. .
.fi .fi
. .

View file

@ -3,13 +3,14 @@ fisher-uninstall(1) -- Disable / Uninstall Plugins
## SYNOPSIS ## SYNOPSIS
fisher `uninstall` [*name* or *url* ...] <br> fisher `uninstall` [*name*, *url* or *path* ...] <br>
fisher `uninstall` [`--force`] [`--quiet`] [`--help`] <br> fisher `uninstall` [`--force`] [`--quiet`] [`--help`] <br>
## USAGE ## USAGE
fisher `uninstall` *plugin* ...<br> fisher `uninstall` *plugin* ...<br>
fisher `uninstall` *owner/repo* ...<br> fisher `uninstall` *owner/repo* ...<br>
fisher `uninstall` *path* ...<br>
## DESCRIPTION ## DESCRIPTION
@ -35,7 +36,7 @@ Uninstall does not remove any dependencies installed with other plugins. This be
* Uninstall all plugins and flush the cache. * Uninstall all plugins and flush the cache.
``` ```
fisher --cache=base | fisher uninstall --force fisher --list | fisher uninstall --force
``` ```
## SEE ALSO ## SEE ALSO

View file

@ -7,10 +7,10 @@
\fBfisher\-update\fR \- Fisherman Update Manager \fBfisher\-update\fR \- Fisherman Update Manager
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
fisher \fBupdate\fR [\fIname\fR or \fIurl\fR \.\.\.] fisher \fBupdate\fR [\fIname\fR, \fIurl\fR or \fIpath\fR \.\.\.]
. .
.br .br
fisher \fBupdate\fR [\fB\-\-me\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] fisher \fBupdate\fR [\fB\-\-quiet\fR] [\fB\-\-help\fR]
. .
.br .br
. .
@ -21,20 +21,19 @@ fisher \fBupdate\fR \fIplugin\fR \.\.\.
fisher \fBupdate\fR \fIowner/repo\fR \.\.\. fisher \fBupdate\fR \fIowner/repo\fR \.\.\.
. .
.br .br
fisher \fBupdate\fR \fIpath\fR \.\.\.
.
.br
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Update one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, read the standard input\. If you try to update a plugin that is currently disabled, but available in the cache, it will be updated and then enabled\. Update one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR or by \fIurl\fR\. If no arguments are given, update Fisherman by default\. If you try to update a plugin that is currently disabled, but downloaded to the cache, it will be updated and then enabled\. Use a dash \fB\-\fR to read from the standard input\.
. .
.P .P
If a plugin is missing dependencies, they will be installed\. If any dependencies are already installed they will not be updated in order to prevent mismatching version issues\. See \fBfisher help fishfile\fR#{\fBPlugins\fR}\. If a plugin is missing dependencies, they will be installed\. If any dependencies are already installed they will not be updated\. See \fBfisher help fishfile\fR#{\fBPlugins\fR}\.
. .
.SH "OPTIONS" .SH "OPTIONS"
. .
.TP .TP
\fB\-m\fR \fB\-\-me\fR
Update Fisherman\.
.
.TP
\fB\-q\fR \fB\-\-quiet\fR \fB\-q\fR \fB\-\-quiet\fR
Enable quiet mode\. Enable quiet mode\.
. .
@ -50,7 +49,7 @@ Update all plugins in the cache\.
.IP "" 0 .IP "" 0
. .
.P .P
fisher \-\-cache=base | fisher update fisher \-\-list | fisher update \-
. .
.SH "SEE ALSO" .SH "SEE ALSO"
\fBfisher\fR(1) \fBfisher\fR(1)

View file

@ -3,25 +3,23 @@ fisher-update(1) -- Fisherman Update Manager
## SYNOPSIS ## SYNOPSIS
fisher `update` [*name* or *url* ...] <br> fisher `update` [*name*, *url* or *path* ...] <br>
fisher `update` [`--me`] [`--quiet`] [`--help`] <br> fisher `update` [`--quiet`] [`--help`] <br>
## USAGE ## USAGE
fisher `update` *plugin* ...<br> fisher `update` *plugin* ...<br>
fisher `update` *owner/repo* ...<br> fisher `update` *owner/repo* ...<br>
fisher `update` *path* ...<br>
## DESCRIPTION ## DESCRIPTION
Update one or *more* plugins by *name*, searching `$fisher_index` or by *url*. If no arguments are given, read the standard input. If you try to update a plugin that is currently disabled, but available in the cache, it will be updated and then enabled. Update one or *more* plugins by *name*, searching `$fisher_index` or by *url*. If no arguments are given, update Fisherman by default. If you try to update a plugin that is currently disabled, but downloaded to 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 in order to prevent mismatching version issues. See `fisher help fishfile`#{`Plugins`}. If a plugin is missing dependencies, they will be installed. If any dependencies are already installed they will not be updated. See `fisher help fishfile`#{`Plugins`}.
## OPTIONS ## OPTIONS
* `-m` `--me`:
Update Fisherman.
* `-q` `--quiet`: * `-q` `--quiet`:
Enable quiet mode. Enable quiet mode.
@ -32,7 +30,7 @@ If a plugin is missing dependencies, they will be installed. If any dependencies
* Update all plugins in the cache. * Update all plugins in the cache.
fisher --cache=base | fisher update fisher --list | fisher update -
## SEE ALSO ## SEE ALSO

View file

@ -10,15 +10,16 @@
\fBfisher\fR \fIcommand\fR [\fIoptions\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] \fBfisher\fR \fIcommand\fR [\fIoptions\fR] [\fB\-\-version\fR] [\fB\-\-help\fR]
. .
.br .br
\fBfisher\fR \fB\-\-list\fR
.
.br
\fBfisher\fR \fB\-\-alias\fR[=\fIcommand\fR=[\fIalias\fR[,\.\.\.]]]
.
.br
\fBfisher\fR \fB\-\-file\fR=\fIfishfile\fR \fBfisher\fR \fB\-\-file\fR=\fIfishfile\fR
. .
.br .br
\fBfisher\fR \fB\-\-validate\fR=\fIname\fR or \fIurl\fR \fBfisher\fR \fB\-\-validate\fR
.
.br
\fBfisher\fR \fB\-\-cache\fR[=\fIpath\fR]
.
.br
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Fisherman is a plugin manager for \fBfish\fR(1) that lets you share and reuse code, prompts and configurations easily\. Fisherman is a plugin manager for \fBfish\fR(1) that lets you share and reuse code, prompts and configurations easily\.
@ -28,33 +29,37 @@ The following commands are available: \fIinstall\fR, \fIuninstall\fR, \fIupdate\
. .
.SH "OPTIONS" .SH "OPTIONS"
. .
.IP "\(bu" 4 .TP
\fB\-f\fR \fB\-\-file\fR=\fIfishfile\fR: Read \fIfishfile\fR and write contents to standard output\. If \fIfishfile\fR is null or an empty string, your user \fIfishfile\fR in \fB$fisher_config\fR/fishfile will be used instead\. Use a dash \fB\-\fR to force reading from the standard input\. Oh My Fish! bundle files are supported as well\. \fB\-\-list\fR
List plugins in the \fB$fisher_cache\fR\. Includes plugins installed using a custom URL\.
. .
.IP "\(bu" 4 .TP
\fB\-V\fR, \fB\-\-validate\fR=\fIkeyword\fR: Validate a \fIname\fR or \fIurl\fR\. If \fIkeyword\fR resembles a url, the algorithm will attempt to normalize the url by adding / removing missing components\. Otherwise, it will assume \fIkeyword\fR is a potential plugin name and use the following regex \fB^[a\-z]+[\._\-]?[a\-z0\-9]+\fR to validate the string\. This method is used internally to validate user input and support url variations such as \fIowner/repo\fR, \fIgh:owner/repo\fR, \fIbb:owner/repo\fR, etc\. See \fBfisher\fR(7)#{\fBPlugins\fR}\. \fB\-a\fR \fB\-\-alias\fR[=\fIcommand\fR=[\fIalias\fR[,\.\.\.]]]
Define one or more comma\-separated \fIalias\fR for \fIcommand\fR using \fB$fisher_alias\fR\. If no value is given, lists all existing aliases\.
. .
.IP .TP
If \fIkeyword\fR is null or an empty string, \fB\-\-validate\fR reads keyword\fIs\fR from the standard input\. \fB\-f\fR \fB\-\-file\fR=\fIfishfile\fR
Read \fIfishfile\fR and display its contents\. If \fIfishfile\fR is null or an empty string, your user \fIfishfile\fR in \fB$fisher_config\fR/fishfile will be used instead\. Use a dash \fB\-\fR to force reading from the standard input\. oh\-my\-fish bundle files are supported as well\.
. .
.IP "\(bu" 4 .TP
\fB\-\-cache\fR[=\fIbase\fR] Retrieve the path of every plugin downloaded to \fB$fisher_cache\fR\. Includes plugins installed using a custom URL\. Use \-\-cache=\fIbase\fR to select only the name of the plugin\. See \fBbasename\fR(1)\. \fB\-V\fR, \fB\-\-validate\fR
Read the standard input and validate a name, url or path\. If the input is a local path, retrieve the absolute path to the closest directory\. If the input resembles a url, normalize the url according to the rules described in \fBfisher help install\fR\. Otherwise, assume the input is a name and use the regex \fB^[a\-z]+[\._\-]?[a\-z0\-9]+\fR to validate the string\.
. .
.IP "\(bu" 4 .TP
\fB\-v\fR \fB\-\-version\fR: Show version information\. Fisherman\'s current version can be found in the VERSION file at the root of the project\. The version scheme is based in \fBSemantic Versioning\fR and uses Git annotated tags to track releases\. \fB\-v\fR \fB\-\-version\fR
Show version information\. Fisherman\'s current version can be found in the VERSION file at the root of the project\. The version scheme is based in \fBSemantic Versioning\fR and uses Git annotated tags to track releases\.
. .
.IP "\(bu" 4 .TP
\fB\-h\fR \fB\-\-help\fR: Show usage help\. \fB\-h\fR \fB\-\-help\fR
. Show usage help\.
.IP "" 0
. .
.SH "CUSTOM COMMANDS" .SH "CUSTOM COMMANDS"
A Fisherman command is a function that you can invoke using the \fBfisher\fR utility\. By convention, any function of the form \fBfisher_<my_command>\fR is registered as Fisherman command\. You can create plugins that add new commands as well as regular utilities\. See \fBfisher help commands\fR and \fBfisher help plugins\fR for more information\. A Fisherman command is a function that you can invoke using the \fBfisher\fR utility\. By convention, any function like \fBfisher_<my_command>\fR is registered as a Fisherman command\. You can create plugins that add new commands this way\. See \fBfisher help commands\fR and \fBfisher help plugins\fR for more information\.
. .
.SH "EXAMPLES" .SH "EXAMPLES"
. .
.IP "\(bu" 4 .IP "\(bu" 4
Install a plugin\. Install plugins\.
. .
.IP "" 0 .IP "" 0
. .
@ -62,8 +67,7 @@ Install a plugin\.
. .
.nf .nf
fisher install fishtape fisher install fishtape shark
fishtape \-\-help
. .
.fi .fi
. .
@ -83,24 +87,22 @@ fisher \-\-file=path/to/shared/fishfile | fisher install
. .
.IP "" 0 .IP "" 0
. .
.IP "\(bu" 4 .TP
Validate a url\. Define a few aliases:
.
.IP "" 0
. .
.IP "" 4 .IP "" 4
. .
.nf .nf
echo a/b | fisher \-V fisher \-a uninstall=rm,u,del
> https://github\.com/a/b
. .
.fi .fi
. .
.IP "" 0 .IP "" 0
. .
.SH "AUTHORS" .SH "AUTHORS"
Fisherman was created and it is currently maintained by Jorge Bucaran \fIj@bucaran\.me\fR\. Fisherman was created by Jorge Bucaran \fIj@bucaran\.me\fR\.
. .
.P .P
See AUTHORS file for a more complete list of contributors\. See AUTHORS file for a more complete list of contributors\.

View file

@ -4,9 +4,10 @@ fisher(1) -- fish plugin manager
## SYNOPSIS ## SYNOPSIS
`fisher` *command* [*options*] [`--version`] [`--help`]<br> `fisher` *command* [*options*] [`--version`] [`--help`]<br>
`fisher` `--list`<br>
`fisher` `--alias`[=*command*=[*alias*[,...]]]<br>
`fisher` `--file`=*fishfile*<br> `fisher` `--file`=*fishfile*<br>
`fisher` `--validate`=*name* or *url*<br> `fisher` `--validate`
`fisher` `--cache`[=*path*]<br>
## DESCRIPTION ## DESCRIPTION
@ -16,16 +17,17 @@ The following commands are available: *install*, *uninstall*, *update*, *search*
## OPTIONS ## OPTIONS
* `--list`:
List plugins in the `$fisher_cache`. Includes plugins installed using a custom URL.
* `-a` `--alias`[=*command*=[*alias*[,...]]]:
Define one or more comma-separated *alias* for *command* using `$fisher_alias`. If no value is given, lists all existing aliases.
* `-f` `--file`=*fishfile*: * `-f` `--file`=*fishfile*:
Read *fishfile* and write contents to standard output. If *fishfile* is null or an empty string, your user *fishfile* in `$fisher_config`/fishfile will be used instead. Use a dash `-` to force reading from the standard input. Oh My Fish! bundle files are supported as well. Read *fishfile* and display its contents. If *fishfile* is null or an empty string, your user *fishfile* in `$fisher_config`/fishfile will be used instead. Use a dash `-` to force reading from the standard input. oh-my-fish bundle files are supported as well.
* `-V`, `--validate`=*keyword*: * `-V`, `--validate`:
Validate a *name* or *url*. If *keyword* resembles a url, the algorithm will attempt to normalize the url by adding / removing missing components. Otherwise, it will assume *keyword* is a potential plugin name and use the following regex `^[a-z]+[._-]?[a-z0-9]+` to validate the string. This method is used internally to validate user input and support url variations such as *owner/repo*, *gh:owner/repo*, *bb:owner/repo*, etc. See `fisher`(7)#{`Plugins`}. Read the standard input and validate a name, url or path. If the input is a local path, retrieve the absolute path to the closest directory. If the input resembles a url, normalize the url according to the rules described in `fisher help install`. Otherwise, assume the input is a name and use the regex `^[a-z]+[._-]?[a-z0-9]+` to validate the string.
If *keyword* is null or an empty string, `--validate` reads keyword*s* from the standard input.
* `--cache`[=*base*]
Retrieve the path of every plugin downloaded to `$fisher_cache`. Includes plugins installed using a custom URL. Use --cache=*base* to select only the name of the plugin. See `basename`(1).
* `-v` `--version`: * `-v` `--version`:
Show version information. Fisherman's current version can be found in the VERSION file at the root of the project. The version scheme is based in `Semantic Versioning` and uses Git annotated tags to track releases. Show version information. Fisherman's current version can be found in the VERSION file at the root of the project. The version scheme is based in `Semantic Versioning` and uses Git annotated tags to track releases.
@ -35,15 +37,14 @@ The following commands are available: *install*, *uninstall*, *update*, *search*
## CUSTOM COMMANDS ## CUSTOM COMMANDS
A Fisherman command is a function that you can invoke using the `fisher` utility. By convention, any function of the form `fisher_<my_command>` is registered as Fisherman command. You can create plugins that add new commands as well as regular utilities. See `fisher help commands` and `fisher help plugins` for more information. A Fisherman command is a function that you can invoke using the `fisher` utility. By convention, any function like `fisher_<my_command>` is registered as a Fisherman command. You can create plugins that add new commands this way. See `fisher help commands` and `fisher help plugins` for more information.
## EXAMPLES ## EXAMPLES
* Install a plugin. * Install plugins.
``` ```
fisher install fishtape fisher install fishtape shark
fishtape --help
``` ```
* Install plugins from a fishfile or bundle: * Install plugins from a fishfile or bundle:
@ -52,16 +53,15 @@ fishtape --help
fisher --file=path/to/shared/fishfile | fisher install fisher --file=path/to/shared/fishfile | fisher install
``` ```
* Validate a url. * Define a few aliases:
``` ```
echo a/b | fisher -V fisher -a uninstall=rm,u,del
> https://github.com/a/b
``` ```
## AUTHORS ## AUTHORS
Fisherman was created and it is currently maintained by Jorge Bucaran *j@bucaran.me*. Fisherman was created by Jorge Bucaran *j@bucaran.me*.
See AUTHORS file for a more complete list of contributors. See AUTHORS file for a more complete list of contributors.

View file

@ -15,7 +15,7 @@
.br .br
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
getopts is a tool to help parsing command\-line arguments\. It is designed to process command line arguments that follow the POSIX Utility Syntax Guidelines\. If no arguments are given it returns \fB1\fR\. getopts is a command line parser, designed to process command line arguments according to the POSIX Utility Syntax Guidelines\. If no arguments are given it returns \fB1\fR\.
. .
.SH "USAGE" .SH "USAGE"
In the following example: In the following example:
@ -131,7 +131,7 @@ getopts does \fInot\fR read the standard input\. Use getopts to collect options
A double dash, \fB\-\-\fR, marks the end of options\. Arguments after this sequence are placed in the default underscore key, \fB_\fR\. A double dash, \fB\-\-\fR, marks the end of options\. Arguments after this sequence are placed in the default underscore key, \fB_\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
The getopts described in this document is \fInot\fR equivalent to the getopts \fIbuiltin\fR found in other shells\. This tool is only available for \fBfish\fR(1)\. The getopts described in this document is \fInot\fR equivalent to the getopts \fIbuiltin\fR found in other shells\.
. .
.IP "" 0 .IP "" 0
. .

View file

@ -8,7 +8,7 @@ getopts(1) -- Parse CLI options
## DESCRIPTION ## DESCRIPTION
getopts is a tool to help parsing command-line arguments. It is designed to process command line arguments that follow the POSIX Utility Syntax Guidelines. If no arguments are given it returns `1`. getopts is a command line parser, designed to process command line arguments according to the POSIX Utility Syntax Guidelines. If no arguments are given it returns `1`.
## USAGE ## USAGE
@ -97,7 +97,7 @@ end
* A double dash, `--`, marks the end of options. Arguments after this sequence are placed in the default underscore key, `_`. * A double dash, `--`, marks the end of options. Arguments after this sequence are placed in the default underscore key, `_`.
* The getopts described in this document is *not* equivalent to the getopts *builtin* found in other shells. This tool is only available for `fish`(1). * The getopts described in this document is *not* equivalent to the getopts *builtin* found in other shells.
## AUTHORS ## AUTHORS

View file

@ -34,7 +34,7 @@ oh\-my\-fish/bobthefish
.IP "" 0 .IP "" 0
. .
.P .P
To read fishfiles use \fBfisher \-\-file\fR=\fIfishfile\fR\. This will read \fIfishfile\fR sequentially, writing its contents to the standard output\. Oh My Fish! bundle files are supported as well\. To read fishfiles use \fBfisher \-\-file\fR=\fIfishfile\fR\. This will read \fIfishfile\fR sequentially, writing its contents to the standard output\. oh-my-fish bundle files are supported as well\.
. .
.P .P
If \fIfishfile\fR is null or an empty string, the global \fIfishfile\fR in \fB$fisher_config\fR/fishfile will be used\. Use a dash \fB\-\fR to force read from standard input\. If \fIfishfile\fR is null or an empty string, the global \fIfishfile\fR in \fB$fisher_config\fR/fishfile will be used\. Use a dash \fB\-\fR to force read from standard input\.

View file

@ -22,7 +22,7 @@ fishtape
oh-my-fish/bobthefish oh-my-fish/bobthefish
``` ```
To read fishfiles use `fisher --file`=*fishfile*. This will read *fishfile* sequentially, writing its contents to the standard output. Oh My Fish! bundle files are supported as well. To read fishfiles use `fisher --file`=*fishfile*. This will read *fishfile* sequentially, writing its contents to the standard output. oh-my-fish bundle files are supported as well.
If *fishfile* is null or an empty string, the global *fishfile* in `$fisher_config`/fishfile will be used. Use a dash `-` to force read from standard input. If *fishfile* is null or an empty string, the global *fishfile* in `$fisher_config`/fishfile will be used. Use a dash `-` to force read from standard input.

View file

@ -4,7 +4,7 @@
.TH "FISHER\-FAQ" "7" "January 2016" "" "fisherman" .TH "FISHER\-FAQ" "7" "January 2016" "" "fisherman"
. .
.SH "NAME" .SH "NAME"
\fBfisher\-faq\fR \- Fisherman Frequently Asked Questions \fBfisher\-faq\fR \- Frequently Asked Questions
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
This document attempts to answer some of Fisherman most frequently asked questions\. Feel free to create a new issue in the Fisherman issue tracker if your question is not answered here\. This document attempts to answer some of Fisherman most frequently asked questions\. Feel free to create a new issue in the Fisherman issue tracker if your question is not answered here\.
@ -50,14 +50,14 @@ There is no technical distinction between plugins, themes, commands, etc\., but
.P .P
See \fBfisher help plugins\fR and \fBfisher help commands\fR\. See \fBfisher help plugins\fR and \fBfisher help commands\fR\.
. .
.SS "Does Fisherman support Oh My Fish! plugins and themes?" .SS "Does Fisherman support oh\-my\-fish plugins and themes?"
Yes\. To install either a plugin or theme use their URL: Yes\. To install either a plugin or theme use their URL:
. .
.IP "" 4 .IP "" 4
. .
.nf .nf
fisher install omf/{rbenv,hub,theme\-scorphish} fisher install omf/plugin\-{rbenv,tab} omf/theme\-scorphish
. .
.fi .fi
. .
@ -87,19 +87,19 @@ end
.P .P
See \fB$fisher_home/config\.fish\fR for the full code\. See \fB$fisher_home/config\.fish\fR for the full code\.
. .
.SS "How is Fisherman faster than Oh My Fish!/Wahoo, etc?" .SS "How is Fisherman faster than oh\-my\-fish/Wahoo, etc?"
Fisherman ameliorates the slow shell start problem using a flat dependency tree instead of loading a directory hierarchy per plugin\. This also means that Fisherman performance does not decline depending on the number of plugins installed\. See also \fBfisher\fR(7)#{\fBFlat Tree\fR}\. Fisherman ameliorates the slow shell start problem using a flat dependency tree instead of loading a directory hierarchy per plugin\. This also means that Fisherman performance does not decline depending on the number of plugins installed\. See also \fBfisher\fR(7)#{\fBFlat Tree\fR}\.
. .
.SS "Why don\'t you contribute your improvements back to Oh My Fish! instead of creating a new project?" .SS "Why don\'t you contribute your improvements back to oh\-my\-fish instead of creating a new project?"
I have contributed back to Oh My Fish! extensively\. See also Oh My Fish! history for August 27, 2015 when another project, Wahoo, was entirely merged with Oh My Fish!\. I have contributed back to oh\-my\-fish extensively\. See also oh\-my\-fish history for August 27, 2015 when another project, Wahoo, was entirely merged with oh\-my\-fish\.
. .
.P .P
In addition, Fisherman was built from the ground up using a completely different design, implementation and set of principles\. In addition, Fisherman was built from the ground up using a completely different design, implementation and set of principles\.
. .
.P .P
Some features include: UNIX familiarity, minimalistic design, flat tree structure, unified plugin architecture, external self\-managed database, cache system, dependency manifest file and compatibility with Oh My Fish!, etc\. See \fBfisher\fR(7)\. Some features include: UNIX familiarity, minimalistic design, flat tree structure, unified plugin architecture, external self\-managed database, cache system, dependency manifest file and compatibility with oh\-my\-fish, etc\. See \fBfisher\fR(7)\.
. .
.SS "How can I upgrade from an existing Oh My Fish! or Wahoo installation?" .SS "How can I upgrade from an existing oh\-my\-fish or Wahoo installation?"
Install Fisherman\. Install Fisherman\.
. .
.IP "" 4 .IP "" 4
@ -115,7 +115,7 @@ make
.IP "" 0 .IP "" 0
. .
.P .P
You can now safely remove Oh My Fish! \fB$OMF_PATH\fR and \fB$OMF_CONFIG\fR\. You can now safely remove oh\-my\-fish \fB$OMF_PATH\fR and \fB$OMF_CONFIG\fR\.
. .
.P .P
Backup dotfiles and other sensitive data first\. Backup dotfiles and other sensitive data first\.
@ -185,5 +185,5 @@ chsh \-s /bin/another/shell
. .
.IP "" 0 .IP "" 0
. .
.SS "Why is this FAQ similar to the Oh My Fish! FAQ?" .SS "Why is this FAQ similar to the oh\-my\-fish FAQ?"
Because it was written by the same author of Fisherman and Wahoo and some of the questions and answers simply overlap\. Because it was written by the same author of Fisherman and Wahoo and some of the questions and answers simply overlap\.

View file

@ -1,5 +1,5 @@
fisher-faq(7) -- Fisherman Frequently Asked Questions fisher-faq(7) -- Frequently Asked Questions
===================================================== ===========================================
## SYNOPSIS ## SYNOPSIS
@ -50,12 +50,12 @@ There is no technical distinction between plugins, themes, commands, etc., but t
See `fisher help plugins` and `fisher help commands`. See `fisher help plugins` and `fisher help commands`.
### Does Fisherman support Oh My Fish! plugins and themes? ### Does Fisherman support oh-my-fish plugins and themes?
Yes. To install either a plugin or theme use their URL: Yes. To install either a plugin or theme use their URL:
``` ```
fisher install omf/{rbenv,hub,theme-scorphish} fisher install omf/plugin-{rbenv,tab} omf/theme-scorphish
``` ```
You can use the same mechanism to a valid plugin from any given URL. See also `fisher`(7)#{`Compatibility`}. You can use the same mechanism to a valid plugin from any given URL. See also `fisher`(7)#{`Compatibility`}.
@ -77,20 +77,20 @@ end
See `$fisher_home/config.fish` for the full code. See `$fisher_home/config.fish` for the full code.
### How is Fisherman faster than Oh My Fish!/Wahoo, etc? ### How is Fisherman faster than oh-my-fish/Wahoo, etc?
Fisherman ameliorates the slow shell start problem using a flat dependency tree instead of loading a directory hierarchy per plugin. This also means that Fisherman performance does not decline depending on the number of plugins installed. See also `fisher`(7)#{`Flat Tree`}. Fisherman ameliorates the slow shell start problem using a flat dependency tree instead of loading a directory hierarchy per plugin. This also means that Fisherman performance does not decline depending on the number of plugins installed. See also `fisher`(7)#{`Flat Tree`}.
### Why don't you contribute your improvements back to Oh My Fish! instead of creating a new project? ### Why don't you contribute your improvements back to oh-my-fish instead of creating a new project?
I have contributed back to Oh My Fish! extensively. See also Oh My Fish! history for August 27, 2015 when another project, Wahoo, was entirely merged with Oh My Fish!. I have contributed back to oh-my-fish extensively. See also oh-my-fish history for August 27, 2015 when another project, Wahoo, was entirely merged with oh-my-fish.
In addition, Fisherman was built from the ground up using a completely different design, implementation and set of principles. In addition, Fisherman was built from the ground up using a completely different design, implementation and set of principles.
Some features include: UNIX familiarity, minimalistic design, flat tree structure, unified plugin architecture, external self-managed database, cache system, dependency manifest file and compatibility with Oh My Fish!, etc. See `fisher`(7). Some features include: UNIX familiarity, minimalistic design, flat tree structure, unified plugin architecture, external self-managed database, cache system, dependency manifest file and compatibility with oh-my-fish, etc. See `fisher`(7).
### How can I upgrade from an existing Oh My Fish! or Wahoo installation? ### How can I upgrade from an existing oh-my-fish or Wahoo installation?
Install Fisherman. Install Fisherman.
@ -100,7 +100,7 @@ cd fisherman
make make
``` ```
You can now safely remove Oh My Fish! `$OMF_PATH` and `$OMF_CONFIG`. You can now safely remove oh-my-fish `$OMF_PATH` and `$OMF_CONFIG`.
Backup dotfiles and other sensitive data first. Backup dotfiles and other sensitive data first.
@ -141,6 +141,6 @@ chsh -s /bin/another/shell
``` ```
### Why is this FAQ similar to the Oh My Fish! FAQ? ### Why is this FAQ similar to the oh-my-fish FAQ?
Because it was written by the same author of Fisherman and Wahoo and some of the questions and answers simply overlap. Because it was written by the same author of Fisherman and Wahoo and some of the questions and answers simply overlap.

View file

@ -105,7 +105,7 @@ end
.IP "" 0 .IP "" 0
. .
.IP "\(bu" 4 .IP "\(bu" 4
Add completions\. \fIwtc\fR is simple enough that you could get away without \fB__fish_parse_usage\fR, but more complex utilities, or utilities whose CLI evolves over time, can benefit using automatic completion generation\. Note that in order to use \fB__fish_parse_usage\fR, your command must provide a \fB\-\-help\fR option that prints usage information to standard output\. Add completions\. \fIwtc\fR is simple enough that you could get away without \fB__fisher_complete\fR, but more complex utilities, or utilities whose CLI evolves over time, can benefit using automatic completion generation\. Note that in order to use \fB__fisher_complete\fR, your command must provide a \fB\-\-help\fR option that prints usage information to standard output\.
. .
.IP .IP
\fBmkdir\fR completions \fBmkdir\fR completions
@ -120,7 +120,7 @@ Add completions\. \fIwtc\fR is simple enough that you could get away without \fB
.nf .nf
set \-l IFS ";" set \-l IFS ";"
wtc \-\-help | __fish_parse_usage | while read \-l info long short wtc \-\-help | __fisher_complete | while read \-l info long short
complete \-c wtc \-s "$short" \-l "$long" \-d "$info" complete \-c wtc \-s "$short" \-l "$long" \-d "$info"
end end
^C ^C

View file

@ -68,14 +68,14 @@ end
^C ^C
``` ```
* Add completions. *wtc* is simple enough that you could get away without `__fish_parse_usage`, but more complex utilities, or utilities whose CLI evolves over time, can benefit using automatic completion generation. Note that in order to use `__fish_parse_usage`, your command must provide a `--help` option that prints usage information to standard output. * Add completions. *wtc* is simple enough that you could get away without `__fisher_complete`, but more complex utilities, or utilities whose CLI evolves over time, can benefit using automatic completion generation. Note that in order to use `__fisher_complete`, your command must provide a `--help` option that prints usage information to standard output.
`mkdir` completions<br> `mkdir` completions<br>
`cat` > completions/wtc.fish `cat` > completions/wtc.fish
``` ```
set -l IFS ";" set -l IFS ";"
wtc --help | __fish_parse_usage | while read -l info long short wtc --help | __fisher_complete | while read -l info long short
complete -c wtc -s "$short" -l "$long" -d "$info" complete -c wtc -s "$short" -l "$long" -d "$info"
end end
^C ^C

View file

@ -10,7 +10,7 @@
Fisherman is a plugin manager for \fBfish\fR(1) that lets you share and reuse code, prompts and configurations easily\. Fisherman is a plugin manager for \fBfish\fR(1) that lets you share and reuse code, prompts and configurations easily\.
. .
.P .P
Some features include: minimalistic design, flat tree structure, unified plugin architecture, external self\-managed database, cache system, dependency manifest file and compatibility with Oh My Fish! and other frameworks\. Some features include: minimalistic design, flat tree structure, unified plugin architecture, external self\-managed database, cache system, dependency manifest file and compatibility with oh-my-fish and other frameworks\.
. .
.P .P
This document describes Fisherman features and some of their implementation details\. For usage and command help see also \fBfisher\fR(1)\. This document describes Fisherman features and some of their implementation details\. For usage and command help see also \fBfisher\fR(1)\.
@ -291,16 +291,16 @@ Most commands read the standard input by default when no options are given and p
Fisherman also ships with a CLI options parser and a background job wait spinner that you can use to implement your own commands CLI\. See \fBgetopts\fR(1) and \fBwait\fR(1)\. Fisherman also ships with a CLI options parser and a background job wait spinner that you can use to implement your own commands CLI\. See \fBgetopts\fR(1) and \fBwait\fR(1)\.
. .
.SH "COMPATIBILITY" .SH "COMPATIBILITY"
Fisherman supports Oh My Fish! (Wahoo) themes and plugins by default, but some features are turned off due to performance considerations\. Fisherman supports oh-my-fish (Wahoo) themes and plugins by default, but some features are turned off due to performance considerations\.
. .
.P .P
Oh My Fish! evaluates every \fI\.fish\fR file inside the root directory of every plugin during initialization\. This is necessary in order to register any existing \fBinit\fR events and invoke them using fish \fBemit\fR(1)\. oh-my-fish evaluates every \fI\.fish\fR file inside the root directory of every plugin during initialization\. This is necessary in order to register any existing \fBinit\fR events and invoke them using fish \fBemit\fR(1)\.
. .
.P .P
Since it is not possible to determine whether a file defines an initialization event without evaluating its contents first, Oh My Fish! sources all \fI\.fish\fR files and then emits events for each plugin\. Since it is not possible to determine whether a file defines an initialization event without evaluating its contents first, oh-my-fish sources all \fI\.fish\fR files and then emits events for each plugin\.
. .
.P .P
Not all plugins opt in the initialization mechanism, therefore support for this behavior is turned off by default\. If you would like Fisherman to behave like Oh My Fish! at the start of each session, install the \fBomf\fR compatibility plugin\. Not all plugins opt in the initialization mechanism, therefore support for this behavior is turned off by default\. If you would like Fisherman to behave like oh-my-fish at the start of each session, install the \fBomf\fR compatibility plugin\.
. .
.IP "" 4 .IP "" 4
. .
@ -313,7 +313,7 @@ fisher install omf
.IP "" 0 .IP "" 0
. .
.P .P
This plugin also adds definitions for some of Oh My Fish! Core Library functions\. This plugin also adds definitions for some of oh-my-fish Core Library functions\.
. .
.SH "SEE ALSO" .SH "SEE ALSO"
\fBfisher\fR(1) \fBfisher\fR(1)

View file

@ -5,7 +5,7 @@ fisher(7) -- An Introduction to Fisherman
Fisherman is a plugin manager for `fish`(1) that lets you share and reuse code, prompts and configurations easily. Fisherman is a plugin manager for `fish`(1) that lets you share and reuse code, prompts and configurations easily.
Some features include: minimalistic design, flat tree structure, unified plugin architecture, external self-managed database, cache system, dependency manifest file and compatibility with Oh My Fish! and other frameworks. Some features include: minimalistic design, flat tree structure, unified plugin architecture, external self-managed database, cache system, dependency manifest file and compatibility with oh-my-fish and other frameworks.
This document describes Fisherman features and some of their implementation details. For usage and command help see also `fisher`(1). This document describes Fisherman features and some of their implementation details. For usage and command help see also `fisher`(1).
@ -180,19 +180,19 @@ Fisherman also ships with a CLI options parser and a background job wait spinner
## COMPATIBILITY ## COMPATIBILITY
Fisherman supports Oh My Fish! (Wahoo) themes and plugins by default, but some features are turned off due to performance considerations. Fisherman supports oh-my-fish (Wahoo) themes and plugins by default, but some features are turned off due to performance considerations.
Oh My Fish! evaluates every *.fish* file inside the root directory of every plugin during initialization. This is necessary in order to register any existing `init` events and invoke them using fish `emit`(1). oh-my-fish evaluates every *.fish* file inside the root directory of every plugin during initialization. This is necessary in order to register any existing `init` events and invoke them using fish `emit`(1).
Since it is not possible to determine whether a file defines an initialization event without evaluating its contents first, Oh My Fish! sources all *.fish* files and then emits events for each plugin. Since it is not possible to determine whether a file defines an initialization event without evaluating its contents first, oh-my-fish sources all *.fish* files and then emits events for each plugin.
Not all plugins opt in the initialization mechanism, therefore support for this behavior is turned off by default. If you would like Fisherman to behave like Oh My Fish! at the start of each session, install the `omf` compatibility plugin. Not all plugins opt in the initialization mechanism, therefore support for this behavior is turned off by default. If you would like Fisherman to behave like oh-my-fish at the start of each session, install the `omf` compatibility plugin.
``` ```
fisher install omf fisher install omf
``` ```
This plugin also adds definitions for some of Oh My Fish! Core Library functions. This plugin also adds definitions for some of oh-my-fish Core Library functions.
## SEE ALSO ## SEE ALSO

View file

@ -1,68 +0,0 @@
function add(k, v) {
if (seen[k v]++) return
print k (v == "" ? "" : " "v)
}
function pop() {
return (size <= 0) ? "_" : stack[size--]
}
function push(k) {
stack[++size] = k
}
function flush() {
while (size) {
add(pop())
}
}
$0 == "" { next }
done {
add("_" , $1$2$3)
next
}
$1 == "--" && !$2 {
done = 1
next
}
$1 !~ /^-|^--/ {
add(pop(), $0)
next
}
size { flush() }
$3 {
for (i = 4; i <= NF; i++)
$3 = $3" "$i
}
$1 == "--" {
if ($3 == "")
push($2)
else
add($2, $3)
}
$1 == "-" {
if ($2 == "") {
print $1
next
} else {
n = split($2, keys, "")
}
if ($3 == "")
push(keys[n])
else
add(keys[n], $3)
for (i = 1; i < n; i++)
add(keys[i])
}
END { flush() }

View file

@ -21,8 +21,8 @@ test "read a fishfile using --file"
(fisher --file=$fishfile) = foo bar baz github/foo/bar (fisher --file=$fishfile) = foo bar baz github/foo/bar
end end
test "fisher --cache=base retrieves plugin names in the cache" test "fisher --list retrieves plugin names in the cache"
(fisher --cache=base) = ( (fisher --list) = (
for file in $fisher_cache/* for file in $fisher_cache/*
basename $file basename $file
end) end)
@ -45,7 +45,7 @@ test "evaluate \$fisher_alias=<command=alias[,...]> as aliases"
end end
test "display usage" test "display usage"
(fisher | sed 1q) = "usage: fisher <command> [<options>] [--version] [--help]" (fisher | sed 3q | xargs) = "usage: fisher [--version] [--help] [--list] [--quiet] [-a <command>=alias[,...]] [-f <path>] <command> [<options>]"
end end
test "display help information about 'help' at the bottom" test "display help information about 'help' at the bottom"

View file

@ -22,11 +22,11 @@ test "help wraps `fisher` w/o arguments"
end end
test "help --all shows commands and guides" test "help --all shows commands and guides"
! -z (fisher help --all | grep -E 'Fisherman commands:$|Fisherman guides:$' | xargs) ! -z (fisher help --all | grep -E 'Available Commands:$|Other Documentation:$' | xargs)
end end
test "help --guides shows guides" test "help --guides shows guides"
! -z (fisher help --guides | grep -E 'Fisherman guides:$' | xargs) ! -z (fisher help --guides | grep -E 'Other Documentation:$' | xargs)
end end
test "help --usage shows command usage info" test "help --usage shows command usage info"
@ -38,3 +38,8 @@ for i in $sections
(fisher help $name | xargs) = $name (fisher help $name | xargs) = $name
end end
end end
test "display usage help"
(fisher help --commands=bare | fisher help --usage | xargs
) = "usage: fisher help [<keyword>] [--all] [--guides] [--help] -a --all List available documentation -g --guides List available guides -u --usage[=<cmd>] Display command usage help -h --help Show usage help usage: fisher install [<name or url> ...] [--link] [--quiet] [--help] -s --link Install as symbolic links -q --quiet Enable quiet mode -h --help Show usage help usage: fisher search [<name or url>] [--select=<source>] [--quiet] [--or|--and] [--field=<field>] [--help] -s --select=<source> Select all, cache or remote plugins -f --field=<field> Filter by name, url, info, tag or author -a --and Join query with AND operator -o --or Join query with OR operator -q --quiet Enable quiet mode -h --help Show usage help usage: fisher uninstall [<name or url> ...] [--force] [--quiet] [--help] -f --force Delete copy from cache -q --quiet Enable quiet mode -h --help Show usage help usage: fisher update [<name or url> ...] [--quiet] [--help] -q --quiet Enable quiet mode -h --help Show usage help"
end

View file

@ -35,7 +35,7 @@ test "adds installed plugins to fishfile"
end end
test "downloads plugin repos to cache" test "downloads plugin repos to cache"
(fisher --cache=base) = $names (fisher --list) = $names
end end
test "download INDEX copy to the cache" test "download INDEX copy to the cache"

View file

@ -1,19 +0,0 @@
test "display help help"
(fisher help --help | xargs) = "usage: fisher help [<keyword>] [--all] [--guides] [--usage[=<command>]] [--help] -a --all List commands and guides -g --guides List documentation guides -u --usage[=<command>] Display command usage help -h --help Show usage help"
end
test "display install help"
(fisher install --help | xargs) = "usage: fisher install [<name or url> ...] [--quiet] [--help] -q --quiet Enable quiet mode -h --help Show usage help"
end
test "display search help"
(fisher search --help | xargs) = "usage: fisher search [<name or url>] [--select=<source>] [--field=<field>] [--or|--and] [--quiet] [--help] -s --select=<source> Select all, cache or remote plugins -f --field=<field> Filter by name, url, info, tag or author -a --and Join query with AND operator -o --or Join query with OR operator -q --quiet Enable quiet mode -h --help Show usage help"
end
test "display uninstall help"
(fisher uninstall --help | xargs) = "usage: fisher uninstall [<name or url> ...] [--force] [--quiet] [--help] -f --force Delete copy from cache -q --quiet Enable quiet mode -h --help Show usage help"
end
test "display update help"
(fisher update --help | xargs) = "usage: fisher update [<name or url> ...] [--me] [--quiet] [--help] -m --me Update Fisherman -q --quiet Enable quiet mode -h --help Show usage help"
end

View file

@ -29,7 +29,6 @@ function -S setup
fisher_mock_repos $source2/$name fisher_mock_repos $source2/$name
git -C $fisher_cache/$name remote rm origin
git -C $fisher_cache/$name remote add origin file://$source2/$name git -C $fisher_cache/$name remote add origin file://$source2/$name
end end

View file

@ -7,57 +7,79 @@ function -S setup
end end
test "validate names" test "validate names"
$id[1] = (fisher --validate=$id[1]) $id[1] = (printf "%s\n" $id[1] | fisher --validate)
end end
test "validate uris" test "validate uris"
$fisher_default_host/$id[1]/$id[2] = (fisher --validate=$id[1]/$id[2]) $fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2] | fisher --validate)
end end
test "validate names may end with a number" test "validate names may end with a number"
"a0" = (fisher --validate=a0) "a0" = (printf "%s\n" a0 | fisher --validate)
end end
test "validate names may start in uppercase" test "validate names may start in uppercase"
-z (fisher --validate=A) -z (printf "%s\n" A | fisher --validate)
end end
test "validate names may not start with a number" test "validate names may not start with a number"
-z (fisher --validate=0abc) -z (printf "%s\n" 0abc | fisher --validate)
end end
test "supress validation output" test "supress validation output"
-z (fisher -q --validate=$id[1]) -z (printf "%s\n" $id[1] | fisher --validate --quiet)
end end
test "remove `/' from uris" test "remove `/' from uris"
$fisher_default_host/$id[1]/$id[2] = (fisher --validate=$id[1]/$id[2]/) $fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2]/ | fisher --validate)
end end
test "remove `.git' from uris" test "remove `.git' from uris"
$fisher_default_host/$id[1]/$id[2] = (fisher --validate=$id[1]/$id[2].git) $fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2].git | fisher --validate)
end end
test "file:/// uris" test "file:/// uris"
! -z (fisher --validate=file:///$id[1]/$id[2].git) ! -z (printf "%s\n" file:///$id[1]/$id[2].git | fisher --validate)
end end
test "id/id uris" test "id/id uris"
! -z (fisher --validate=$id[1]/$id[2].git) ! -z (printf "%s\n" $id[1]/$id[2].git | fisher --validate)
end end
test "short owner/repo uris" test "short owner/repo uris"
https://github.com/$id[1]/$id[2] = (fisher --validate=github/$id[1]/$id[2]) https://github.com/$id[1]/$id[2] = (
printf "%s\n" github/$id[1]/$id[2] | fisher --validate)
end end
test "short $short:owner/repo uris" test "short $short:owner/repo uris"
https://github.com/$id[1]/$id[2] = (fisher --validate=gh:$id[1]/$id[2]) https://github.com/$id[1]/$id[2] = (
printf "%s\n" gh:$id[1]/$id[2] | fisher --validate)
end end
test "short bitbucket urls uris" test "short bitbucket urls uris"
https://bitbucket.org/$id[1]/$id[2] = (fisher --validate=bb:$id[1]/$id[2]) https://bitbucket.org/$id[1]/$id[2] = (
printf "%s\n" bb:$id[1]/$id[2] | fisher --validate)
end end
test "short gitlab urls uris" test "short gitlab urls uris"
https://gitlab.com/$id[1]/$id[2] = (fisher --validate=gl:$id[1]/$id[2]) https://gitlab.com/$id[1]/$id[2] = (
printf "%s\n" gl:$id[1]/$id[2] | fisher --validate)
end
test "omf: urls"
https://github.com/oh-my-fish/theme-default = (
printf "%s\n" omf:theme-default | fisher --validate)
end
test "omf/ urls"
https://github.com/oh-my-fish/theme-default = (
printf "%s\n" omf/theme-default | fisher --validate)
end
test "urls with a period"
https://github.com/oh-my-fish/theme-cmorrell.com = (
printf "%s\n" omf/theme-cmorrell.com | fisher --validate)
end end