diff --git a/CHANGELOG.md b/CHANGELOG.md index fa1178d..2c8504e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,45 @@ -# Changelog +# Change Log +* [0.2.0](#020) * [0.1.0](#010) -## 0.1.0 - 2016-01-01 +## 0.2.0 - 2016-01-05 + +* Improved README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors. + +* :warning: Removed `fisher update --cache` in favor of `fisher --cache | fisher update` and `fisher uninstall --all` in favor of `fisher --cache | 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. + +* Added `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. + +* 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. + +* Fixed a bug with `mktemp` failing on some systems. Closes #7. Thanks @tobywf. + +* Added [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 load themes within the same shell, without having to restart the session using `exec fish`. Shoddy themes, for example those failing to declare global variables with the `-g` flag still require the session to be reset. See [**related**][bobthefish-19]. Closes #4. + +* Move `getopts` implementation to `share/getopts.awk`. Closes #3. + +* Support dots inside URIs in `fisher --validate`. Closes #2. + +* Refactored and improved tests for `install`, `update` and `uninstall`. + +## [0.1.0][v010] - 2016-01-01 * Initial commit. + + +:anchor: + + + +[v010]: https://github.com/fisherman/fisherman/commit/3386ed052ae4a84338c340d37b98c1742f8a45f6 +[bobthefish-19]: https://github.com/oh-my-fish/theme-bobthefish/pull/19 +[code_of_conduct]: CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6866339 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,55 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of +fostering an open and welcoming community, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to +fairly and consistently applying these principles to every aspect of managing +this project. Project maintainers who do not follow or enforce the Code of +Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting a project maintainer at [Fisherman][email]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. Maintainers are +obligated to maintain confidentiality with regard to the reporter of an +incident. + + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.3.0, available at +[http://contributor-covenant.org/version/1/3/0/][version] + +:anchor: + + + +[email]: mailto:j@bucaran.me +[version]: http://contributor-covenant.org/version/1/3/0/ +[homepage]: http://contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99b8b98..c8fe1f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ You can start contributing right away: * [Join][join] the community. * [Spread][tweet] the voice. -* [Bugs][bugs]? :beetle: +* Report [bugs][bugs]. If you are looking for other ways to help, peruse [open issues][issues]. If you are already working on something, feel free to send us a PR. @@ -12,7 +12,7 @@ If you are looking for other ways to help, peruse [open issues][issues]. If you * Fork the repo and create your feature branch from master. -* Test before you push. Get familiar with [Fishtape][fishtape]. +* Test before you push. Get familiar with **[Fishtape][fishtape]**. * If you've changed APIs, update the documentation. @@ -25,14 +25,17 @@ Third-party plugins are essential for keeping this project exciting. To learn ho To browse the available content use `fisher search` or see the [Fisherman Index][fisher-index]. - + [org]: https://github.com/fisherman -[fishtape]: https://github.com/fisherman/fishtape [join]: https://gitter.im/fisherman/wharf [bugs]: https://github.com/fisherman/fisherman/issues [issues]: https://github.com/fisherman/fisherman/issues?q=is%3Aopen+is%3Aissue +[fishtape]: https://github.com/fisherman/fishtape [fish-docs]: http://fishshell.com/docs/current/index.html [seven-rules]: http://chris.beams.io/posts/git-commit/#seven-rules -[tweet]: https://twitter.com/intent/tweet?url=https%3A%2F%2Fgit.io%2Ffisher&via=jbucaran&text=Check+out+%23Fisherman+for+the+%23fishshell [fisher-index]: https://github.com/fisherman/fisher-index + +[tweet]: https://twitter.com/intent/tweet?url=https%3A%2F%2Fgit.io%2Ffisher&via=jbucaran&text=Check+out+%23Fisherman+for+the+%23fishshell + +:anchor: diff --git a/Makefile b/Makefile index ab52f9f..62ee618 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ $(FISH_CONFIG): @echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher @echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher @echo "source \$$fisher_home/config.fish" >> $@.fisher - @awk '!config[$$0]++' $@.fisher $@ > $@.tmp + @awk '!config[$$0]++ || /^$$/' $@.fisher $@ > $@.tmp @mv $@.tmp $@ && rm $@.fisher $(FISHER_CACHE): diff --git a/README.md b/README.md index 6860572..a7c06d5 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,13 @@ ## About -Fisherman is a shell manager for [fish][fish] that lets you share and reuse code, prompts and configurations easily. +Fisherman is a plugin manager for [fish][fish] that lets you share and reuse code, prompts and configurations easily. -Features include a flat tree structure, unified plugin architecture, external self-managed database, cache system, plugin dependencies and compatibility with Oh My Fish! +Features include a flat tree structure, external self-managed database, cache system, plugin dependencies and compatibility with Oh My Fish! packages. + ++ See [FAQ][faq]. ++ See [Screencasts][screencasts]. -See [FAQ][faq]. ## Install @@ -22,6 +24,7 @@ See [FAQ][faq]. git clone https://github.com/fisherman/fisherman cd fisherman make +fisher help ``` ## Contributing @@ -30,7 +33,10 @@ Check out the [contribution](CONTRIBUTING.md) guidelines. ## Help -See [`fisherman(1)`][fisherman-1] and [`fisherman(7)`][fisherman-7] for usage and documentation. For support and feedback join the [Gitter room][wharf] or browse the [issues][issues]. +See [`fisherman(1)`][fisherman-1] and [`fisherman(7)`][fisherman-7] for usage and documentation. For support and feedback join the Gitter [room][wharf] or browse the [issues][issues]. + + +:anchor: @@ -39,6 +45,7 @@ See [`fisherman(1)`][fisherman-1] and [`fisherman(7)`][fisherman-7] for usage an [faq]: https://github.com/fisherman/fisherman/wiki/FAQ [issues]: http://github.com/fisherman/fisherman/issues [wharf]: https://gitter.im/fisherman/wharf +[screencasts]: https://github.com/fisherman/fisherman/wiki/Screencasts [fisherman-1]: man/man1/fisher.md [fisherman-7]: man/man7/fisher.md [travis-link]: https://travis-ci.org/fisherman/fisherman diff --git a/completions/fisher.fish b/completions/fisher.fish index d638a3b..09a4e95 100644 --- a/completions/fisher.fish +++ b/completions/fisher.fish @@ -1,31 +1,13 @@ +complete -xc fisher -d "Fisherman" +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 h -l help -d "Display help" complete -c fisher -n "__fish_use_subcommand" -s f -l file -d "Read fishfile" -if test -e $fisher_cache/.index - set -l cache (for file in $fisher_cache/* - if test -d $file - basename $file - end - end) - - awk -v FS='\n' -v RS='' -v OFS=' ' '/^ *#/ { next } { print $1,$3 }' $fisher_cache/.index \ - | while read -l name info - switch "$name" - case $cache - for cmd in update uninstall - complete -c fisher -n "__fish_seen_subcommand_from $cmd" -a "$name" -d "$info" - end - - case \* - complete -c fisher -n "__fish_seen_subcommand_from install" -a "$name" -d "$info" - end - end -end +set -l index $fisher_cache/.index +set -l IFS ";" for option in commands guides - set -l IFS ";" - 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" @@ -42,5 +24,14 @@ for option in commands guides end end -complete -c fisher -n "__fish_seen_subcommand_from search" -a "\t" -complete -xc fisher -d "Fisherman" +if test -e $fisher_cache/.index + fisher search --index=$index --select=cache --name --info | while read -l name info + for command in update uninstall + 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 diff --git a/config.fish b/config.fish index 4c8ad33..e3af53c 100644 --- a/config.fish +++ b/config.fish @@ -6,6 +6,6 @@ set fisher_error_log $fisher_cache/.debug_log set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path -for file in $fisher_config/functions/*.config.fish +for file in $fisher_config/conf.d/*.config.fish source $file end diff --git a/functions/fisher.fish b/functions/fisher.fish index d3cf035..3b6e66a 100644 --- a/functions/fisher.fish +++ b/functions/fisher.fish @@ -1,4 +1,4 @@ -function fisher -d "Fish Shell Manager" +function fisher -d "Fish plugin manager" if not set -q argv[1] fisher --help return 1 @@ -19,8 +19,12 @@ function fisher -d "Fish Shell Manager" set option help set value $value $2 - case path-in-cache - set option path-in-cache + case cache + set option cache + set value $2 + + case translate + set option translate set value $2 case f file @@ -78,22 +82,36 @@ function fisher -d "Fish Shell Manager" set fisher_default_host https://github.com end - set -l id "[A-Za-z0-9_-]" + 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#^(@|(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 path-in-cache - while read --prompt= -l item + case cache + for file in $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/* diff --git a/functions/fisher_install.fish b/functions/fisher_install.fish index f87ffe7..43f1564 100644 --- a/functions/fisher_install.fish +++ b/functions/fisher_install.fish @@ -11,7 +11,7 @@ function fisher_install -d "Enable / Install Plugins" set error /dev/null case h help - printf "usage: fisher install [ ...] [--quiet] [--help]\n\n" + printf "usage: fisher install [ ...] [--quiet] [--help]\n\n" printf " -q --quiet Enable quiet mode\n" printf " -h --help Show usage help\n" @@ -25,8 +25,8 @@ function fisher_install -d "Enable / Install Plugins" end set -l count 0 - set -l duration (date +%s) set -l total (count $items) + set -l elapsed (date +%s) if set -q items[1] printf "%s\n" $items @@ -38,14 +38,14 @@ function fisher_install -d "Enable / Install Plugins" switch "$item" case \*/\* printf "%s %s\n" $item ( - if not fisher_search --url=$item --field=name + if not fisher_search --url=$item --name printf "%s" $item | sed -E ' s/.*\/(.*)/\1/ - s/^(plugin|theme|pkg|fish)-//' + s/^(plugin|theme|pkg|omf|fish|fisher)-//' end) case \* - if set -l url (fisher_search --name=$item --field=url) + if set -l url (fisher_search --name=$item --url) printf "%s %s\n" $url $item else if test -d $fisher_cache/$item @@ -68,7 +68,7 @@ function fisher_install -d "Enable / Install Plugins" printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error end - mkdir -p $fisher_config/{cache,functions,completions,man} + mkdir -p $fisher_config/{cache,functions,completions,conf.d,man} set -l path $fisher_cache/$name @@ -91,7 +91,8 @@ function fisher_install -d "Enable / Install Plugins" printf "Resolving dependencies in %s\n" $name/(basename $bundle) > $error set -l deps (fisher --file=$bundle \ - | fisher_install ^&1 | sed -En 's/([0-9]+) plugin\/s.*/\1/p') + | fisher_install ^&1 \ + | sed -En 's/([0-9]+) plugin\/s.*/\1/p') set count (math $count + 0$deps) end @@ -108,18 +109,28 @@ function fisher_install -d "Enable / Install Plugins" 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 + functions -e fish_{,right_}prompt end for file in $path/{*,functions{/*,/**/*}}.fish set -l base (basename $file) - switch $base - case {init,uninstall}.fish - set base $name.config.$base - end - cp -f $file $fisher_config/functions/$base - end - source $fisher_config/functions/$name.fish > /dev/null ^& 1 + switch $base + case {$name,fish_{,right_}prompt}.fish + source $file + + case {init,uninstall}.fish + set base $name.(basename $base .fish).config.fish + end + + switch $base + case \*\?.config.fish + cp -f $file $fisher_config/conf.d/$base + + case \* + cp -f $file $fisher_config/functions/$base + end + end cp -f $path/completions/*.fish $fisher_config/completions/ ^ /dev/null @@ -135,7 +146,7 @@ function fisher_install -d "Enable / Install Plugins" set -l file $fisher_config/fishfile if test -s $file - if fisher --file=$file | grep -Eq "^$name\$|^$url\$" + if fisher --file=$file | grep -Eq "^$name\$|^$url\$" continue end end @@ -147,11 +158,10 @@ function fisher_install -d "Enable / Install Plugins" end printf "%s\n" "$name" >> $file - end printf "%d plugin/s installed (%0.fs)\n" (math $count) ( - math (date +%s) - $duration) > $error + math (date +%s) - $elapsed) > $error if not test $count -gt 0 return 1 diff --git a/functions/fisher_search.fish b/functions/fisher_search.fish index 02a993d..52379c5 100644 --- a/functions/fisher_search.fish +++ b/functions/fisher_search.fish @@ -1,11 +1,10 @@ function fisher_search -d "Search Fisherman Index" - set -l index $fisher_cache/.index - set -l select all set -l fields set -l join "||" set -l query set -l quiet 0 + set -l index getopts $argv | while read -l 1 2 3 switch "$1" @@ -69,11 +68,14 @@ function fisher_search -d "Search Fisherman Index" case Q query set query $query $2 + case index + set index $2 + case q quiet set quiet 1 case h help - printf "usage: fisher search [] [--select=] [--field=]\n" + printf "usage: fisher search [] [--select=] [--field=]\n" printf " [--or|--and] [--quiet] [--help]\n\n" printf " -s --select= Select all, cache or remote plugins \n" @@ -91,7 +93,7 @@ function fisher_search -d "Search Fisherman Index" end end - if not set -q fields[1] + if test -z "$fields[1]" set fields '$0' end @@ -100,33 +102,88 @@ function fisher_search -d "Search Fisherman Index" switch "$select" case all - if not fisher_update --quiet --index + if test -z "$index" + set index $fisher_cache/.index + if test -s $fisher_index set index $fisher_index + else + fisher_update --quiet --index end end - if not cat $index ^ /dev/null + if not test -s $index printf "fisher: '%s' invalid path or url\n" $index >& 2 return 1 end + set -l cache (fisher --cache=base) + awk -v FS='\n' -v RS='' -v cache_items="$cache" ' + + BEGIN { + split(cache_items, cache, " ") + } + + /^ *#/ { next } { + for (i in cache) { + if (cache[i] == $1) { + delete cache[i] + } + } + } + + END { + for (i in cache) { + printf("%s\n", cache[i]) + } + } + + ' $index | while read -l orphan + git -C $fisher_cache/$orphan ls-remote --get-url \ + | read -l url + + printf "%s\n" $url \ + | sed -E ' + s|^https?://|| + s|^github\.com|| + s|^bitbucket.org|bb:| + s|^gitlab.com|gl:| + s|^/||' \ + | read -l info + + git -C $fisher_cache/$orphan show -s --format='%ae;%an' ( + git -C $fisher_cache/$orphan rev-list --max-parents=0 HEAD) \ + | awk -v FS=';' '{ printf("%s\n", ($1 ? $1 : $2 ? $2 : "unknown")) }' \ + | read -l author + + set -l tags orphan + + for tag in theme plugin oh-my-fish config + if printf "%s" "$url" | grep -q $tag + switch "$tag" + case oh-my-fish + set tag omf + end + set tags $tag $tags + end + end + + printf "\n%s\n%s\n%s\n%s\n%s\n\n" "$orphan" "$url" "$info" "$tags" "$author" + end + + cat $index + case remote - fisher_search -a --name!=( - fisher_search --field=name --select=cache) + fisher_search --index=$index --and --name!=(fisher --cache=base) case cache - set -l names (for file in $fisher_cache/* - if test -d $file - basename $file - end - end) + fisher --cache=base | read -laz cache - if test -z "$names" + if test -z "$cache" return 1 end - fisher_search --select=all --name=$names + fisher_search --index=$index --select=all --name=$cache end | awk -F'\n' -v RS='' -v OFS=';' ( if test "$fields" = '$0' @@ -164,10 +221,10 @@ function fisher_search -d "Search Fisherman Index" $query { print $fields } - " | sed '${/^$/d;}' | awk -v q=$quiet ' - !/^ *$/ { ret = 1 } - !q { print } - q && !ret { exit !ret } - END { exit !ret } + " | sed '${/^$/d;}' | awk -v quiet=$quiet ' + !/^ *$/ { notEmpty = 1 } + !quiet { print } + quiet && !notEmpty { exit !notEmpty } + END { exit !notEmpty } ' end diff --git a/functions/fisher_uninstall.fish b/functions/fisher_uninstall.fish index 7acc52d..e001557 100644 --- a/functions/fisher_uninstall.fish +++ b/functions/fisher_uninstall.fish @@ -18,10 +18,8 @@ function fisher_uninstall -d "Disable / Uninstall Plugins" set error /dev/null case help h - printf "usage: fisher uninstall [ ...] [--all] [--force] [--quiet]\n" - printf " [--help]\n\n" + printf "usage: fisher uninstall [ ...] [--force] [--quiet] [--help]\n\n" - printf " -a --all Uninstall all plugins \n" printf " -f --force Delete copy from cache \n" printf " -q --quiet Enable quiet mode \n" printf " -h --help Show usage help \n" @@ -38,21 +36,12 @@ function fisher_uninstall -d "Disable / Uninstall Plugins" set -l duration (date +%s) set -l total (count $items) - switch all - case $option - set -l cache (find $fisher_cache/* -maxdepth 0 -type d) - set total (count $cache) - printf "%s\n" $cache + if set -q items[1] + printf "%s\n" $items + else + fisher --file=- - case \* - if set -q items[1] - printf "%s\n" $items - else - fisher --file=- - - end | fisher --validate | fisher --path-in-cache - - end | while read -l path + end | fisher --validate | fisher --translate | while read -l path if not test -d "$path" printf "fisher: '%s' not found\n" $path > $error @@ -73,17 +62,22 @@ function fisher_uninstall -d "Disable / Uninstall Plugins" set count (math $count + 1) - functions -e $name - for file in $path/{*,functions{/*,/**/*}}.fish set -l base (basename $file) switch $base + case {$name,fish_{,right_}prompt}.fish + functions -e (basename $base .fish) + + if test "$base" = fish_prompt.fish + source $__fish_datadir/functions/fish_prompt.fish ^ /dev/null + end + case {init,before.init,uninstall}.fish - set base $name.$base + set base $name.(basename $base .fish).config.fish end - rm -f $fisher_config/functions/$base + rm -f $file $fisher_config/{functions,conf.d}/$base end for file in $path/completions/*.fish @@ -111,7 +105,7 @@ function fisher_uninstall -d "Disable / Uninstall Plugins" continue end - set -l tmp (mktemp) + set -l tmp (mktemp -t fisher.XXX) if not sed -E '/^ *'(printf "%s|%s" $name $url | sed 's|/|\\\/|g' )'([ #].*)*$/d' < $file > $tmp diff --git a/functions/fisher_update.fish b/functions/fisher_update.fish index 2e0bd32..6ace259 100644 --- a/functions/fisher_update.fish +++ b/functions/fisher_update.fish @@ -10,33 +10,28 @@ function fisher_update -d "Fisherman Update Manager" set items $items $2 case index - set option $option index - - case s {,it,my,one}self fisher{,man} - set option $option self - - case c cache - set option $option cache + set option index case path set option path set path $2 + case m me self fisher{,man} + set option $option me + case q quiet if test -z "$2" set 2 /dev/null end + set error $2 case help h - printf "usage: fisher update [ ...] [--self] [--cache]\n" - printf " [--path=] [--quiet] [--help]\n\n" + printf "usage: fisher update [ ...] [--me] [--quiet] [--help]\n\n" - printf " -s --self Update Fisherman \n" - printf " -c --cache Update cached plugins \n" - printf " --path= Update repository at given path \n" - printf " -q --quiet Enable quiet mode \n" - printf " -h --help Show usage help \n" + printf " -m --me Update Fisherman\n" + printf " -q --quiet Enable quiet mode\n" + printf " -h --help Show usage help \n" return case \* @@ -46,8 +41,8 @@ function fisher_update -d "Fisherman Update Manager" end end - switch path - case $option + switch "$option" + case path if not test -d $path printf "fisher: '%s' invalid path\n" $path > $error return 1 @@ -57,26 +52,17 @@ function fisher_update -d "Fisherman Update Manager" git -C $path checkout --quiet master ^/dev/null git -C $path pull --quiet --rebase origin master" - return - end - - switch index - case $option + case index mkdir -p $fisher_cache - set -l index $fisher_cache/.(random) + set -l index $fisher_cache/.index.tmp - if not wait --spin=pipe --log=$fisher_error_log "curl -sS $fisher_index > $index" - rm -f $index - cat $fisher_error_log > $error - - return 1 + if curl -s $fisher_index > $index + mv -f $index $fisher_cache/.index end - mv -f $index $fisher_cache/.index - end + rm -f $index - switch self - case $option + case me set -l elap (date +%s) printf "Updating >> Fisherman\n" > $error @@ -86,64 +72,47 @@ function fisher_update -d "Fisherman Update Manager" end printf "Done without errors (%0.fs)\n" (math (date +%s) - $elap) > $error - end - - set -l elap (date +%s) - set -l count 0 - set -l total (count $items) - - switch cache - case $option - set -l cache (find $fisher_cache/* -maxdepth 0 -type d) - set total (count $cache) - printf "%s\n" $cache case \* + set -l elap (date +%s) + set -l count 0 + set -l total (count $items) + if set -q items[1] printf "%s\n" $items else - - if contains -- $option self - return - end - - if contains -- $option index - return - end - fisher --file=- - end | fisher --validate | fisher --path-in-cache + end | fisher --validate | fisher --translate | while read -l path - end | while read -l path + if not test -d "$path" + printf "fisher: '%s' not found\n" $path > $error + continue + end - if not test -d "$path" - printf "fisher: '%s' not found\n" $path > $error - continue - end + set -l name (basename $path) - set -l name (basename $path) + printf "Updating " > $error - printf "Updating " > $error + switch $total + case 0 1 + printf ">> %s\n" $name > $error - switch $total - case 0 1 - printf ">> %s\n" $name > $error + case \* + printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error + end - case \* - printf "(%s of %s) >> %s\n" (math 1 + $count) $total $name > $error - end + if not fisher_update --path=$path --quiet=$error + sed -nE 's/.*(error|fatal): (.*)/error: \2/p' $fisher_error_log > $error + continue + end - if not fisher_update --path=$path --quiet=$error - sed -nE 's/.*(error|fatal): (.*)/error: \2/p' $fisher_error_log > $error - continue - end + fisher install $name --quiet - fisher install $name --quiet + set count (math $count + 1) + end - set count (math $count + 1) + printf "%d plugin/s updated (%0.fs)\n" $count (math (date +%s) - $elap) > $error + + test $count -gt 0 end - - printf "%d plugin/s updated (%0.fs)\n" $count (math (date +%s) - $elap) > $error - - test $count -gt 0 end diff --git a/functions/getopts.fish b/functions/getopts.fish index 7d04010..7a1a57a 100644 --- a/functions/getopts.fish +++ b/functions/getopts.fish @@ -6,28 +6,5 @@ function getopts -d "Parse CLI options" printf "%s\n" $argv | sed -E ' s/^-([A-Za-z]+)/- \1 / s/^--([A-Za-z0-9_-]+)(!?)=?(.*)/-- \1 \3 \2 /' | \ - awk ' - 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() } - ' + awk -f $fisher_home/share/getopts.awk end diff --git a/functions/wait.fish b/functions/wait.fish index b8b5099..ed7e95f 100644 --- a/functions/wait.fish +++ b/functions/wait.fish @@ -90,7 +90,7 @@ function wait -d "Run commands and wait with a spin" end end - set -l tmp (mktemp) + set -l tmp (mktemp -t wait.XXX) fish -c "$commands" ^ $tmp & diff --git a/man/man1/fisher-help.1 b/man/man1/fisher-help.1 index e2fc0ca..3928991 100644 --- a/man/man1/fisher-help.1 +++ b/man/man1/fisher-help.1 @@ -69,8 +69,12 @@ Display usage help for \fIcommand\fR\. To supply usage help with a command, \fIc Show usage help\. . .SH "EXAMPLES" +. +.IP "\(bu" 4 Display usage help for all Fisherman commands\. . +.IP "" 0 +. .IP "" 4 . .nf diff --git a/man/man1/fisher-help.md b/man/man1/fisher-help.md index fa798a2..67cd2c2 100644 --- a/man/man1/fisher-help.md +++ b/man/man1/fisher-help.md @@ -48,7 +48,7 @@ There are utilities that can help you generate man pages from other text formats ## EXAMPLES -Display usage help for all Fisherman commands. +* Display usage help for all Fisherman commands. ``` fisher help --commands=bare | fisher help --usage diff --git a/man/man1/fisher-install.1 b/man/man1/fisher-install.1 index 3bf8853..5dbeed1 100644 --- a/man/man1/fisher-install.1 +++ b/man/man1/fisher-install.1 @@ -21,13 +21,56 @@ fisher \fBinstall\fR \fIowner/repo\fR \.\.\. 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 -If a copy of the plugin already exists in \fB$fisher_cache\fR, 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 instead\. +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\. . .P -If the plugin declares any dependencies, they will be installed as well\. 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}\. +In addition, all of the following variations are accepted: +. +.IP "\(bu" 4 +\fBgithub\fR/owner/repo \fB\->\fR https://github\.com/owner/repo +. +.br + +. +.IP "\(bu" 4 +\fBgh:\fRowner/repo \fB\->\fR https://github\.com/owner/repo +. +.br + +. +.IP "" 0 . .P -If a plugin includes either a fish_prompt\.\fBfish\fR or fish_right_prompt\.\fBfish\fR, both files are first removed from \fB$fisher_config\fR/functions and then the new one\fIs\fR are copied\. +Shortcuts for other common Git repository hosting services are also available: +. +.IP "\(bu" 4 +\fBbb:\fR/owner/repo \fB\->\fR https://bitbucket\.org/owner/repo +. +.br + +. +.IP "\(bu" 4 +\fBgl:\fR/owner/repo \fB\->\fR https://gitlab\.com/owner/repo +. +.br + +. +.IP "\(bu" 4 +\fBomf:\fR/owner/repo \fB\->\fR https://github\.com/oh\-my\-fish/repo +. +.br + +. +.IP "" 0 +. +.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\. +. +.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}\. +. +.P +If a plugin includes either a fish_prompt\.fish or fish_right_prompt\.fish, both files are first removed from \fB$fisher_config\fR/functions and then the new ones are copied\. . .SH "OPTIONS" . @@ -101,7 +144,7 @@ Here is the \fIplugin\fR tree inside the cache: .br . .P -And here is how files are copied from \fB$fisher_cache\fR/plugin to \fB$fisher_config\fR: +And thisi is how the files are copied from \fB$fisher_cache\fR/plugin to \fB$fisher_config\fR: . .IP "1." 4 \fIplugin\fR\.fish \fB\->\fR $fisher_config/functions diff --git a/man/man1/fisher-install.md b/man/man1/fisher-install.md index 091dd51..c797452 100644 --- a/man/man1/fisher-install.md +++ b/man/man1/fisher-install.md @@ -14,11 +14,24 @@ fisher `install` *owner/repo* ...
Install one or *more* plugins by *name*, searching `$fisher_index` or by *url*. If no arguments are given, read the standard input. -If a copy of the plugin already exists in `$fisher_cache`, 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` instead. +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 plugin declares any dependencies, they will be installed as well. If any dependencies are already installed they will not be updated in order to prevent mismatching version issues. See `fisher help fishfile`#{`Plugins`}. +In addition, all of the following variations are accepted: -If a plugin includes either a fish_prompt.`fish` or fish_right_prompt.`fish`, both files are first removed from `$fisher_config`/functions and then the new one*s* are copied. +* `github`/owner/repo `->` https://github.com/owner/repo
+* `gh:`owner/repo `->` https://github.com/owner/repo
+ +Shortcuts for other common Git repository hosting services are also available: + +* `bb:`/owner/repo `->` https://bitbucket.org/owner/repo
+* `gl:`/owner/repo `->` https://gitlab.com/owner/repo
+* `omf:`/owner/repo `->` https://github.com/oh-my-fish/repo
+ +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 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 a plugin includes either a fish_prompt.fish or fish_right_prompt.fish, both files are first removed from `$fisher_config`/functions and then the new ones are copied. ## OPTIONS @@ -55,7 +68,7 @@ Here is the *plugin* tree inside the cache: |-- *plugin*.1
-And here is how files are copied from `$fisher_cache`/plugin to `$fisher_config`: +And thisi is how the files are copied from `$fisher_cache`/plugin to `$fisher_config`: 1. *plugin*.fish `->` $fisher_config/functions 2. functions/plugin_helper.fish `->` $fisher_config/functions diff --git a/man/man1/fisher-search.1 b/man/man1/fisher-search.1 index 24914b5..1ff3531 100644 --- a/man/man1/fisher-search.1 +++ b/man/man1/fisher-search.1 @@ -71,19 +71,19 @@ See #{\fBOutput\fR} for more information\. . .TP \fB\-s\fR \fB\-\-select\fR[=\fIall\fR|\fIcache\fR|\fIremote\fR] -Select record set\. \-\-select=\fIcache\fR queries only local plugins, i\.e\., those inside \fB$fisher_cache\fR\. \-\-select=\fIremote\fR queries all plugins not in the cache\. \-\-select=\fIall\fR queries everything\. +Select the record source\. \-\-select=\fIcache\fR queries only local plugins, i\.e\., those inside \fB$fisher_cache\fR\. \-\-select=\fIremote\fR queries all plugins not in the cache, i\.e, those available to install\. \-\-select=\fIall\fR queries everything\. . .TP \fB\-f\fR \fB\-\-field\fR=\fIname\fR|\fIurl\fR|\fIinfo\fR|\fItag\fR|\fIauthor\fR -Display only given fields from the result record set\. Use \fB\-\-select\fR to filter the record set\. Use \-\-\fIfield\fR instead as a shortcut, i\.e\., \fB\-\-name\fR is equivalent to \fB\-\-field\fR=name\. +Display only the given fields from the selected records\. Use \-\-\fIfield\fR instead as a shortcut for \fB\-\-field\fR=name\. . .TP \-\-\fIfield\fR[=\fImatch\fR] -Filter the result set by \fIfield\fR=\fImatch\fR, where \fIfield\fR can be any of \fBname\fR, \fBurl\fR, \fBinfo\fR, \fBtag\fR or \fBauthor\fR\. If \fImatch\fR is not given, this is equivalent to \fB\-\-select\fR=\fIfield\fR\. Use \fB!=\fR to negate the query\. +Filter the result set by \fIfield\fR=\fImatch\fR, where \fIfield\fR can be one or more of \fBname\fR, \fBurl\fR, \fBinfo\fR, \fBtag\fR or \fBauthor\fR\. If \fImatch\fR is not given, this is equivalent to \fB\-\-select\fR=\fIfield\fR\. Use \fB!=\fR to negate the query\. . .TP \-\-\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 essentially 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 \fB\-a\fR \fB\-\-and\fR @@ -112,7 +112,7 @@ The default behavior is to print the result set to standard output in its origin . .nf -fisher search bobthefish shark +fisher search shark . .fi . @@ -125,12 +125,6 @@ fisher search bobthefish shark . .nf -bobthefish -https://github\.com/oh\-my\-fish/theme\-bobthefish -A Powerline\-style, Git\-aware fish theme optimized for awesome -theme powerline awesome -bobthecow - shark https://github\.com/bucaran/shark Sparklines for your Fish @@ -148,7 +142,7 @@ Search is optimized for parsing when using filters: \fB\-\-name\fR, \fB\-\-url\f . .nf -fisher search bobthefish shark \-\-name \-\-url +fisher search shark \-\-name \-\-url . .fi . @@ -161,7 +155,6 @@ fisher search bobthefish shark \-\-name \-\-url . .nf -bobthefish;https://github\.com/oh\-my\-fish/theme\-bobthefish shark;https://github\.com/bucaran/shark . .fi @@ -172,8 +165,12 @@ shark;https://github\.com/bucaran/shark The result set above consists of single line \fB\'\en\'\fR separated records where each record consists of one or more of the given fields separated by a semicolon \fB\';\'\fR\. . .SH "EXAMPLES" +. +.IP "\(bu" 4 Display all plugins by name and format into multiple columns\. . +.IP "" 0 +. .IP "" 4 . .nf @@ -184,9 +181,11 @@ fisher search \-\-name | column . .IP "" 0 . -.P +.IP "\(bu" 4 Display all plugins by url, sans \fIhttps://github\.com/\fR and format into multiple columns\. . +.IP "" 0 +. .IP "" 4 . .nf @@ -197,9 +196,11 @@ fisher search \-\-field=url \-\-select=all | sed \'s|https://github\.com/||\' | . .IP "" 0 . -.P +.IP "\(bu" 4 Display all remote plugins by name tagged as \fIa\fR or \fIb\fR\. . +.IP "" 0 +. .IP "" 4 . .nf @@ -210,9 +211,11 @@ fisher search \-\-select=remote \-\-name \-\-tag=github \-\-or \-\-tag=tool . .IP "" 0 . -.P +.IP "\(bu" 4 Search plugins from a list of one or more urls and / or names and display their authors\. . +.IP "" 0 +. .IP "" 4 . .nf @@ -223,9 +226,11 @@ fisher search $urls $names \-\-url . .IP "" 0 . -.P +.IP "\(bu" 4 Search all plugins in the cache whose name does not start with the letter \fBs\fR\. . +.IP "" 0 +. .IP "" 4 . .nf diff --git a/man/man1/fisher-search.md b/man/man1/fisher-search.md index 0ca14f7..c384af6 100644 --- a/man/man1/fisher-search.md +++ b/man/man1/fisher-search.md @@ -39,16 +39,16 @@ See #{`Output`} for more information. ## OPTIONS * `-s` `--select`[=*all*|*cache*|*remote*]: - Select record set. --select=*cache* queries only local plugins, i.e., those inside `$fisher_cache`. --select=*remote* queries all plugins not in the cache. --select=*all* queries everything. + Select the record source. --select=*cache* queries only local plugins, i.e., those inside `$fisher_cache`. --select=*remote* queries all plugins not in the cache, i.e, those available to install. --select=*all* queries everything. * `-f` `--field`=*name*|*url*|*info*|*tag*|*author*: - Display only given fields from the result record set. Use `--select` to filter the record set. Use --*field* instead as a shortcut, i.e., `--name` is equivalent to `--field`=name. + Display only the given fields from the selected records. Use --*field* instead as a shortcut for `--field`=name. * --*field*[=*match*]: - Filter the result set by *field*=*match*, where *field* can be any 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*`/`]: - 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 essentially 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`: Join query with a logical AND operator. @@ -70,18 +70,12 @@ See #{`Output`} for more information. The default behavior is to print the result set to standard output in its original format. ``` -fisher search bobthefish shark +fisher search shark ``` `...` ``` -bobthefish -https://github.com/oh-my-fish/theme-bobthefish -A Powerline-style, Git-aware fish theme optimized for awesome -theme powerline awesome -bobthecow - shark https://github.com/bucaran/shark Sparklines for your Fish @@ -92,13 +86,12 @@ bucaran Search is optimized for parsing when using filters: `--name`, `--url`, `--info`, `--tags`, `--author` or `--field`=*name*|*url*|*info*|*tag*|*author*. ``` -fisher search bobthefish shark --name --url +fisher search shark --name --url ``` `...` ``` -bobthefish;https://github.com/oh-my-fish/theme-bobthefish shark;https://github.com/bucaran/shark ``` @@ -106,31 +99,31 @@ The result set above consists of single line `'\n'` separated records where each ## EXAMPLES -Display all plugins by name and format into multiple columns. +* Display all plugins by name and format into multiple columns. ``` fisher search --name | column ``` -Display all plugins by url, sans *https://github.com/* and format into multiple columns. +* Display all plugins by url, sans *https://github.com/* and format into multiple columns. ``` fisher search --field=url --select=all | sed 's|https://github.com/||' | column ``` -Display all remote plugins by name tagged as *a* or *b*. +* Display all remote plugins by name tagged as *a* or *b*. ``` fisher search --select=remote --name --tag=github --or --tag=tool ``` -Search plugins from a list of one or more urls and / or names and display their authors. +* Search plugins from a list of one or more urls and / or names and display their authors. ``` fisher search $urls $names --url ``` -Search all plugins in the cache whose name does not start with the letter `s`. +* Search all plugins in the cache whose name does not start with the letter `s`. ``` fisher search --select=cache --name~/^[^s]/ diff --git a/man/man1/fisher-uninstall.1 b/man/man1/fisher-uninstall.1 index e1c2e2b..56979eb 100644 --- a/man/man1/fisher-uninstall.1 +++ b/man/man1/fisher-uninstall.1 @@ -10,7 +10,7 @@ fisher \fBuninstall\fR [\fIname\fR or \fIurl\fR \.\.\.] . .br -fisher \fBuninstall\fR [\fB\-\-all\fR] [\fB\-\-force\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] +fisher \fBuninstall\fR [\fB\-\-force\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] . .br . @@ -29,15 +29,11 @@ Uninstall one or \fImore\fR plugins by \fIname\fR, searching \fB$fisher_index\fR Uninstall does not remove any copies of the given plugin in \fB$fisher_cache\fR\. To erase the copy from the cache, use the \fB\-\-force\fR option\. . .P -Uninstall does not remove dependencies installed along with other plugins\. This behavior prevents breaking plugins that share the same dependency\. See \fBfisher\fR(7){\fBFlat Tree\fR}\. +Uninstall does not remove any dependencies installed with other plugins\. This behavior prevents breaking plugins that share the same dependency\. See \fBfisher\fR(7){\fBFlat Tree\fR}\. . .SH "OPTIONS" . .TP -\fB\-a\fR \fB\-\-all\fR -Uninstall all plugins\. -. -.TP \fB\-f\fR \fB\-\-force\fR Delete copy from cache\. . @@ -50,13 +46,17 @@ Enable quiet mode\. Show usage help\. . .SH "EXAMPLES" -Uninstall all installed plugins and flushing the cache as well\. +. +.IP "\(bu" 4 +Uninstall all plugins and flush the cache\. +. +.IP "" 0 . .IP "" 4 . .nf -fisher uninstall \-\-all \-\-force +fisher \-\-cache=base | fisher uninstall \-\-force . .fi . diff --git a/man/man1/fisher-uninstall.md b/man/man1/fisher-uninstall.md index 7b176da..a66988b 100644 --- a/man/man1/fisher-uninstall.md +++ b/man/man1/fisher-uninstall.md @@ -4,7 +4,7 @@ fisher-uninstall(1) -- Disable / Uninstall Plugins ## SYNOPSIS fisher `uninstall` [*name* or *url* ...]
-fisher `uninstall` [`--all`] [`--force`] [`--quiet`] [`--help`]
+fisher `uninstall` [`--force`] [`--quiet`] [`--help`]
## USAGE @@ -17,13 +17,10 @@ Uninstall one or *more* plugins by *name*, searching `$fisher_index` or by *url* Uninstall does not remove any copies of the given plugin in `$fisher_cache`. To erase the copy from the cache, use the `--force` option. -Uninstall does not remove dependencies installed along with other plugins. This behavior prevents breaking plugins that share the same dependency. See `fisher`(7){`Flat Tree`}. +Uninstall does not remove any dependencies installed with other plugins. This behavior prevents breaking plugins that share the same dependency. See `fisher`(7){`Flat Tree`}. ## OPTIONS -* `-a` `--all`: - Uninstall all plugins. - * `-f` `--force`: Delete copy from cache. @@ -33,13 +30,12 @@ Uninstall does not remove dependencies installed along with other plugins. This * `-h` `--help`: Show usage help. - ## EXAMPLES -Uninstall all installed plugins and flushing the cache as well. +* Uninstall all plugins and flush the cache. ``` -fisher uninstall --all --force +fisher --cache=base | fisher uninstall --force ``` ## SEE ALSO diff --git a/man/man1/fisher-update.1 b/man/man1/fisher-update.1 index 2cb75a8..6373fcf 100644 --- a/man/man1/fisher-update.1 +++ b/man/man1/fisher-update.1 @@ -10,10 +10,7 @@ fisher \fBupdate\fR [\fIname\fR or \fIurl\fR \.\.\.] . .br -fisher \fBupdate\fR [\fB\-\-self\fR] [\fB\-\-cache\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] -. -.br -fisher \fBupdate\fR [\fB\-\-path\fR=\fIpath\fR] +fisher \fBupdate\fR [\fB\-\-me\fR] [\fB\-\-quiet\fR] [\fB\-\-help\fR] . .br . @@ -34,18 +31,10 @@ If a plugin is missing dependencies, they will be installed\. If any dependencie .SH "OPTIONS" . .TP -\fB\-s\fR \fB\-\-self\fR +\fB\-m\fR \fB\-\-me\fR Update Fisherman\. . .TP -\fB\-c\fR \fB\-\-cache\fR -Update all plugins in the cache\. Updates plugins that are currently disabled and enables them\. -. -.TP -\fB\-\-path\fR=\fIpath\fR -Update repository at given path\. The update mechanism is based in Git, via \fBgit pull \-\-rebase\fR\. -. -.TP \fB\-q\fR \fB\-\-quiet\fR Enable quiet mode\. . @@ -53,6 +42,16 @@ Enable quiet mode\. \fB\-h\fR \fB\-\-help\fR Show usage help\. . +.SH "EXAMPLES" +. +.IP "\(bu" 4 +Update all plugins in the cache\. +. +.IP "" 0 +. +.P +fisher \-\-cache=base | fisher update +. .SH "SEE ALSO" \fBfisher\fR(1) . diff --git a/man/man1/fisher-update.md b/man/man1/fisher-update.md index 9420717..c6a92eb 100644 --- a/man/man1/fisher-update.md +++ b/man/man1/fisher-update.md @@ -4,8 +4,7 @@ fisher-update(1) -- Fisherman Update Manager ## SYNOPSIS fisher `update` [*name* or *url* ...]
-fisher `update` [`--self`] [`--cache`] [`--quiet`] [`--help`]
-fisher `update` [`--path`=*path*]
+fisher `update` [`--me`] [`--quiet`] [`--help`]
## USAGE @@ -20,21 +19,21 @@ If a plugin is missing dependencies, they will be installed. If any dependencies ## OPTIONS -* `-s` `--self`: +* `-m` `--me`: Update Fisherman. -* `-c` `--cache`: - Update all plugins in the cache. Updates plugins that are currently disabled and enables them. - -* `--path`=*path*: - Update repository at given path. The update mechanism is based in Git, via `git pull --rebase`. - * `-q` `--quiet`: Enable quiet mode. * `-h` `--help`: Show usage help. +## EXAMPLES + +* Update all plugins in the cache. + +fisher --cache=base | fisher update + ## SEE ALSO `fisher`(1)
diff --git a/man/man1/fisher.1 b/man/man1/fisher.1 index 5ab1e5d..8053c6c 100644 --- a/man/man1/fisher.1 +++ b/man/man1/fisher.1 @@ -4,7 +4,7 @@ .TH "FISHER" "1" "January 2016" "" "fisherman" . .SH "NAME" -\fBfisher\fR \- fish shell manager +\fBfisher\fR \- fish plugin manager . .SH "SYNOPSIS" \fBfisher\fR \fIcommand\fR [\fIoptions\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] @@ -16,36 +16,40 @@ \fBfisher\fR \fB\-\-validate\fR=\fIname\fR or \fIurl\fR . .br +\fBfisher\fR \fB\-\-cache\fR[=\fIpath\fR] +. +.br . .SH "DESCRIPTION" -Fisherman is a shell 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 -The following commands: \fIinstall\fR, \fIuninstall\fR, \fIupdate\fR, \fIsearch\fR and \fIhelp\fR are available by default\. See \fBfisher\fR help \fIcommand\fR for information about each command\. +The following commands are available: \fIinstall\fR, \fIuninstall\fR, \fIupdate\fR, \fIsearch\fR and \fIhelp\fR\. See \fBfisher\fR help \fIcommand\fR for information about each command\. . .SH "OPTIONS" . -.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 too\. +.IP "\(bu" 4 +\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\. . -.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}\. +.IP "\(bu" 4 +\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}\. . .IP If \fIkeyword\fR is null or an empty string, \fB\-\-validate\fR reads keyword\fIs\fR from the standard input\. . -.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\. +.IP "\(bu" 4 +\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)\. . -.TP -\fB\-h\fR \fB\-\-help\fR -Show usage help\. +.IP "\(bu" 4 +\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 +\fB\-h\fR \fB\-\-help\fR: Show usage help\. +. +.IP "" 0 . .SH "CUSTOM COMMANDS" -A Fisherman command is a function that you can invoke using \fBfisher\fR \fIcommand\fR [\fIoptions\fR]\. By convention, any function of the form \fBfisher_\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 of the form \fBfisher_\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\. . .SH "EXAMPLES" . @@ -66,7 +70,7 @@ fishtape \-\-help .IP "" 0 . .TP -Install plugins from fishfile or bundle: +Install plugins from a fishfile or bundle: . .IP "" 4 @@ -80,7 +84,7 @@ fisher \-\-file=path/to/shared/fishfile | fisher install .IP "" 0 . .IP "\(bu" 4 -Validate an url\. +Validate a url\. . .IP "" 0 . diff --git a/man/man1/fisher.md b/man/man1/fisher.md index deb9c56..df3ccdb 100644 --- a/man/man1/fisher.md +++ b/man/man1/fisher.md @@ -1,4 +1,4 @@ -fisher(1) -- fish shell manager +fisher(1) -- fish plugin manager =============================== ## SYNOPSIS @@ -6,23 +6,27 @@ fisher(1) -- fish shell manager `fisher` *command* [*options*] [`--version`] [`--help`]
`fisher` `--file`=*fishfile*
`fisher` `--validate`=*name* or *url*
+`fisher` `--cache`[=*path*]
## DESCRIPTION -Fisherman is a shell 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. -The following commands: *install*, *uninstall*, *update*, *search* and *help* are available by default. See `fisher` help *command* for information about each command. +The following commands are available: *install*, *uninstall*, *update*, *search* and *help*. See `fisher` help *command* for information about each command. ## OPTIONS * `-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 too. + 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. * `-V`, `--validate`=*keyword*: 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`}. 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`: 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. @@ -31,7 +35,7 @@ The following commands: *install*, *uninstall*, *update*, *search* and *help* ar ## CUSTOM COMMANDS -A Fisherman command is a function that you can invoke using `fisher` *command* [*options*]. By convention, any function of the form `fisher_` 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 of the form `fisher_` 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. ## EXAMPLES @@ -42,13 +46,13 @@ fisher install fishtape fishtape --help ``` -* Install plugins from fishfile or bundle: +* Install plugins from a fishfile or bundle: ``` fisher --file=path/to/shared/fishfile | fisher install ``` -* Validate an url. +* Validate a url. ``` echo a/b | fisher -V diff --git a/man/man5/fisher-fishfile.5 b/man/man5/fisher-fishfile.5 index 420ad4b..a6e4046 100644 --- a/man/man5/fisher-fishfile.5 +++ b/man/man5/fisher-fishfile.5 @@ -23,7 +23,7 @@ Here is an example: .nf # my plugins -gitio +shark fishtape # other links @@ -34,10 +34,10 @@ oh\-my\-fish/bobthefish .IP "" 0 . .P -To read fishfiles use \fBfisher \-\-file\fR=\fIfishfile\fR\. This utility reads fishfiles sequentially, writing them to standard output\. Oh My Fish! bundle files are supported too\. +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 -If \fIfishfile\fR is null or an empty string, the global \fIfishfile\fR in \fB$fisher_config\fR/fishfile is used instead\. 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\. . .SH "PLUGINS" Plugins may declare any number of dependencies to other plugins in a fishfile at the root of their project\. diff --git a/man/man5/fisher-fishfile.md b/man/man5/fisher-fishfile.md index 7e5776d..887d824 100644 --- a/man/man5/fisher-fishfile.md +++ b/man/man5/fisher-fishfile.md @@ -15,16 +15,16 @@ Here is an example: ``` # my plugins -gitio +shark fishtape # other links oh-my-fish/bobthefish ``` -To read fishfiles use `fisher --file`=*fishfile*. This utility reads fishfiles sequentially, writing them to standard output. Oh My Fish! bundle files are supported too. +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 is used instead. 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. ## PLUGINS diff --git a/man/man7/fisher-config.7 b/man/man7/fisher-config.7 index 0b73b5c..3f024b3 100644 --- a/man/man7/fisher-config.7 +++ b/man/man7/fisher-config.7 @@ -47,8 +47,12 @@ You can also customize the debug log path, cache location, index source url, com .IP "" 0 . .SH "EXAMPLES" +. +.IP "\(bu" 4 Create aliases for fisher \fBinstall\fR to \fIi\fR, \fIin\fR and \fIinst\fR; and for fisher \fBupdate\fR to \fIup\fR\. . +.IP "" 0 +. .IP "" 4 . .nf @@ -59,9 +63,11 @@ set fisher_alias install=i,in,inst update=up . .IP "" 0 . -.P +.IP "\(bu" 4 Set \fB$fisher_index\fR and \fB$fisher_default_host\fR\. . +.IP "" 0 +. .IP "" 4 . .nf diff --git a/man/man7/fisher-config.md b/man/man7/fisher-config.md index 63016ff..4d31f0d 100644 --- a/man/man7/fisher-config.md +++ b/man/man7/fisher-config.md @@ -40,13 +40,13 @@ You can also customize the debug log path, cache location, index source url, com ## EXAMPLES -Create aliases for fisher `install` to *i*, *in* and *inst*; and for fisher `update` to *up*. +* Create aliases for fisher `install` to *i*, *in* and *inst*; and for fisher `update` to *up*. ``` set fisher_alias install=i,in,inst update=up ``` -Set `$fisher_index` and `$fisher_default_host`. +* Set `$fisher_index` and `$fisher_default_host`. ``` set fisher_index https://raw.../owner/repo/master/index2.txt diff --git a/man/man7/fisher-faq.7 b/man/man7/fisher-faq.7 index a31f15f..bcfafc6 100644 --- a/man/man7/fisher-faq.7 +++ b/man/man7/fisher-faq.7 @@ -10,7 +10,7 @@ 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\. . .SS "What is Fisherman?" -Fisherman is a shell manager for fish that lets you share and reuse code, prompts and configurations easily\. +Fisherman is a plugin manager for fish that lets you share and reuse code, prompts and configurations easily\. . .SS "What do I need to know to use Fisherman?" Nothing\. You can continue using your shell as usual\. When you are ready to learn more just type \fBman fisher\fR or \fBman 7 fisher\fR\. @@ -50,21 +50,21 @@ There is no technical distinction between plugins, themes, commands, etc\., but .P 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: . .IP "" 4 . .nf -fisher install oh\-my\-fish/{rbenv,hub,bobthefish} +fisher install omf/{rbenv,hub,theme\-scorphish} . .fi . .IP "" 0 . .P -You can use the same mechanism to install a Wahoo package or a plugin in a any given URL\. See also \fBfisher\fR(7)#{\fBCompatibility\fR}\. +You can use the same mechanism to a valid plugin from any given URL\. See also \fBfisher\fR(7)#{\fBCompatibility\fR}\. . .SS "What does Fisherman do exactly every time I create a new shell session?" Essentially, add Fisherman functions and completions to the \fB$fish_{function,complete}_path\fR and evaluate files that follow the convention \fB*\.config\.fish\fR\. @@ -76,7 +76,7 @@ Essentially, add Fisherman functions and completions to the \fB$fish_{function,c set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path -for file in $fisher_config/functions/*\.config\.fish +for file in $fisher_config/conf\.d/*\.config\.fish source $file end . @@ -87,14 +87,14 @@ end .P 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}\. . .SS "Why don\'t you contribute your improvements back to Oh My Fish! instead of creating a new project?" -Already done that\. See Oh My Fish! history for August 27, 2015\. The project was then called Wahoo and it 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 -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 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)\. @@ -131,7 +131,7 @@ rm \-rf {$OMF_PATH,$OMF_CONFIG} .IP "" 0 . .SS "I changed my prompt with fish_config and now I can\'t use any Fisherman theme, what do I do?" -\fBfish_config\fR persists the prompt to \fBXDG_CONFIG_HOME/fish/functions\fR/fish_prompt\.fish\. That file takes precedence over Fisherman prompts that install to \fB$fisher_config\fR/functions/\. To use Fisherman prompts remove the \fBfish_promt\.fish\fR inside \fBXDG_CONFIG_HOME/fish/functions/\fR\. +\fBfish_config\fR persists the prompt to \fBXDG_CONFIG_HOME/fish/functions\fR/fish_prompt\.fish\. That file takes precedence over Fisherman prompts that installs to \fB$fisher_config\fR/functions/\. To use Fisherman prompts remove the \fBfish_promt\.fish\fR inside \fBXDG_CONFIG_HOME/fish/functions/\fR\. . .P Assuming \fBXDG_CONFIG_HOME\fR is \fB~/\.config\fR in your system: diff --git a/man/man7/fisher-faq.md b/man/man7/fisher-faq.md index 5b0ec35..4e2deed 100644 --- a/man/man7/fisher-faq.md +++ b/man/man7/fisher-faq.md @@ -8,7 +8,7 @@ This document attempts to answer some of Fisherman most frequently asked questio ### What is Fisherman? -Fisherman is a shell manager for fish that lets you share and reuse code, prompts and configurations easily. +Fisherman is a plugin manager for fish that lets you share and reuse code, prompts and configurations easily. ### What do I need to know to use Fisherman? @@ -50,15 +50,15 @@ There is no technical distinction between plugins, themes, commands, etc., but t 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: ``` -fisher install oh-my-fish/{rbenv,hub,bobthefish} +fisher install omf/{rbenv,hub,theme-scorphish} ``` -You can use the same mechanism to install a Wahoo package or a plugin in a 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`}. ### What does Fisherman do exactly every time I create a new shell session? @@ -69,7 +69,7 @@ Essentially, add Fisherman functions and completions to the `$fish_{function,com set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path -for file in $fisher_config/functions/*.config.fish +for file in $fisher_config/conf.d/*.config.fish source $file end ``` @@ -77,15 +77,15 @@ end 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`}. ### Why don't you contribute your improvements back to Oh My Fish! instead of creating a new project? -Already done that. See Oh My Fish! history for August 27, 2015. The project was then called Wahoo and it 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!. -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). @@ -111,7 +111,7 @@ rm -rf {$OMF_PATH,$OMF_CONFIG} ### I changed my prompt with `fish_config` and now I can't use any Fisherman theme, what do I do? -`fish_config` persists the prompt to `XDG_CONFIG_HOME/fish/functions`/fish_prompt.fish. That file takes precedence over Fisherman prompts that install to `$fisher_config`/functions/. To use Fisherman prompts remove the `fish_promt.fish` inside `XDG_CONFIG_HOME/fish/functions/`. +`fish_config` persists the prompt to `XDG_CONFIG_HOME/fish/functions`/fish_prompt.fish. That file takes precedence over Fisherman prompts that installs to `$fisher_config`/functions/. To use Fisherman prompts remove the `fish_promt.fish` inside `XDG_CONFIG_HOME/fish/functions/`. Assuming `XDG_CONFIG_HOME` is `~/.config` in your system: diff --git a/man/man7/fisher-plugins.7 b/man/man7/fisher-plugins.7 index 219f5b3..66beb4c 100644 --- a/man/man7/fisher-plugins.7 +++ b/man/man7/fisher-plugins.7 @@ -159,7 +159,7 @@ Add basic documentation\. Fisherman uses standard manual pages for displaying he . .IP "\(bu" 4 -Commit changes and push to remote repository\. +Commit changes and push to the remote repository\. . .IP \fBgit\fR add \-\-all diff --git a/man/man7/fisher-plugins.md b/man/man7/fisher-plugins.md index 4050d37..2826f96 100644 --- a/man/man7/fisher-plugins.md +++ b/man/man7/fisher-plugins.md @@ -100,7 +100,7 @@ end ^C ``` -* Commit changes and push to remote repository. +* Commit changes and push to the remote repository. `git` add --all
`git` commit -m "What the commit? 1.0"
diff --git a/man/man7/fisher.7 b/man/man7/fisher.7 index 8dbbf11..797797c 100644 --- a/man/man7/fisher.7 +++ b/man/man7/fisher.7 @@ -7,13 +7,13 @@ \fBfisher\fR \- An Introduction to Fisherman . .SH "DESCRIPTION" -Fisherman is a shell 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 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 -This document describes Fisherman main features and their implementation details\. For usage and command help see \fBfisher\fR(1)\. +This document describes Fisherman features and some of their implementation details\. For usage and command help see also \fBfisher\fR(1)\. . .SH "FLAT TREE" The configuration directory structure is optimized to help fish start new sessions as quickly as possible, regardless of the numbers of plugins or prompts enabled at any given time\. @@ -66,6 +66,8 @@ Here is a snapshot of a typical configuration path with a single plugin and prom $fisher_config |\-\- cache/ +|\-\- conf\.d/ +|\-\- |\-\- my_plugin\.config\.fish |\-\- functions/ | |\-\- my_plugin\.fish | |\-\- fish_prompt\.fish @@ -83,6 +85,9 @@ $fisher_config .P If you are already familiar in the way fish handles your user configuration, you will find the above structure similar to \fB$XDG_CONFIG_HOME/fish\fR\. See \fBhelp fish\fR#{\fBInitialization Files\fR} to learn more about fish configuration\. . +.P +\fBconf\.d\fR, short for configuration directory, is used for initialization files, i\.e\., files that should run at the start of the shell\. Files that follow the naming convention \fIname\fR\.config\.fish are added there\. +. .SS "PLUGINS" Plugins are components that extend and add features to your shell\. To see what plugins are available use \fBfisher search\fR\. You can also type \fBfisher install\fR and hit \fItab\fR once to get full name completions and plugin information\. The same works for \fBfisher update\fR and \fBfisher uninstall\fR\. . @@ -149,11 +154,17 @@ Shortcuts for other common Git repository hosting services are also available: . .br +. +.IP "\(bu" 4 +\fBomf:\fR/owner/repo \fB\->\fR https://github\.com/oh\-my\-fish/repo +. +.br + . .IP "" 0 . .P -A flat tree model means there is no technical distinction between plugins or prompts\. Installing a prompt is equivalent to switching themes in other systems\. The interface is always \fIinstall\fR, \fIupdate\fR or \fIuninstall\fR\. +Because of Fisherman\'s flat tree model, there is no technical distinction between plugins or prompts\. Installing a prompt is equivalent to switching themes in other systems\. The interface is always \fIinstall\fR, \fIupdate\fR or \fIuninstall\fR\. . .P Throughout this document and other Fisherman manuals you will find the term prompt when referring to the \fIconcept\fR of a theme, i\.e\., a plugin that defines a \fBfish_prompt\fR and / or \fBfish_right_prompt\fR functions\. diff --git a/man/man7/fisher.md b/man/man7/fisher.md index 1701ec7..41cdda0 100644 --- a/man/man7/fisher.md +++ b/man/man7/fisher.md @@ -3,11 +3,11 @@ fisher(7) -- An Introduction to Fisherman ## DESCRIPTION -Fisherman is a shell 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. -This document describes Fisherman main features and their implementation details. For usage and command help see `fisher`(1). +This document describes Fisherman features and some of their implementation details. For usage and command help see also `fisher`(1). ## FLAT TREE @@ -43,6 +43,8 @@ Here is a snapshot of a typical configuration path with a single plugin and prom $fisher_config |-- cache/ + |-- conf.d/ + |-- |-- my_plugin.config.fish |-- functions/ | |-- my_plugin.fish | |-- fish_prompt.fish @@ -55,6 +57,8 @@ Here is a snapshot of a typical configuration path with a single plugin and prom If you are already familiar in the way fish handles your user configuration, you will find the above structure similar to `$XDG_CONFIG_HOME/fish`. See `help fish`#{`Initialization Files`} to learn more about fish configuration. +`conf.d`, short for configuration directory, is used for initialization files, i.e., files that should run at the start of the shell. Files that follow the naming convention *name*.config.fish are added there. + ### PLUGINS Plugins are components that extend and add features to your shell. To see what plugins are available use `fisher search`. You can also type `fisher install` and hit *tab* once to get full name completions and plugin information. The same works for `fisher update` and `fisher uninstall`. @@ -84,8 +88,9 @@ Shortcuts for other common Git repository hosting services are also available: * `bb:`/owner/repo `->` https://bitbucket.org/owner/repo
* `gl:`/owner/repo `->` https://gitlab.com/owner/repo
+* `omf:`/owner/repo `->` https://github.com/oh-my-fish/repo
-A flat tree model means there is no technical distinction between plugins or prompts. Installing a prompt is equivalent to switching themes in other systems. The interface is always *install*, *update* or *uninstall*. +Because of Fisherman's flat tree model, there is no technical distinction between plugins or prompts. Installing a prompt is equivalent to switching themes in other systems. The interface is always *install*, *update* or *uninstall*. Throughout this document and other Fisherman manuals you will find the term prompt when referring to the *concept* of a theme, i.e., a plugin that defines a `fish_prompt` and / or `fish_right_prompt` functions. @@ -156,6 +161,7 @@ The fishfile updates as you install / uninstall plugins. See also `fisher help i Plugins may list any number of dependencies to other plugins in a fishfile at the root of each project. By default, when Fisherman installs a plugin, it will also fetch and install its dependencies. If a dependency is already installed, it will not be updated as this could potentially break other plugins using an older version. For the same reasons, uninstalling a plugin does not remove its dependencies. See `fisher help update`. + ### CONFIGURATION Fisherman allows a high level of configuration using `$fisher_*` variables. You can customize the home and configuration directories, debug log file, cache location, index source url, command aliases, etc. See `fisher help config`. diff --git a/package.json b/package.json index 1bb7529..d7f13ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fisherman", - "version": "0.1.0", - "description": "fish shell manager", + "version": "0.2.0", + "description": "fish plugin manager", "main": "index.js", "directories": { "man": "man", diff --git a/share/getopts.awk b/share/getopts.awk new file mode 100644 index 0000000..630789f --- /dev/null +++ b/share/getopts.awk @@ -0,0 +1,68 @@ +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() } diff --git a/test/fisher.fish b/test/fisher.fish index 261191c..604d529 100644 --- a/test/fisher.fish +++ b/test/fisher.fish @@ -21,6 +21,13 @@ test "read a fishfile using --file" (fisher --file=$fishfile) = foo bar baz github/foo/bar end +test "fisher --cache=base retrieves plugin names in the cache" + (fisher --cache=base) = ( + for file in $fisher_cache/* + basename $file + end) +end + test "evaluate commands" (fisher $cmd) = usage:... end diff --git a/FAQ.md b/test/fixtures/source/bar/bar.config.fish similarity index 100% rename from FAQ.md rename to test/fixtures/source/bar/bar.config.fish diff --git a/test/fixtures/source/bar/bar.fish b/test/fixtures/source/bar/bar.fish new file mode 100644 index 0000000..af0fe87 --- /dev/null +++ b/test/fixtures/source/bar/bar.fish @@ -0,0 +1,3 @@ +function bar + echo bar +end diff --git a/test/fixtures/source/bar/completions/bar.fish b/test/fixtures/source/bar/completions/bar.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/bar/completions/bar.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/bar/functions/bar.func.fish b/test/fixtures/source/bar/functions/bar.func.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/bar/functions/bar.func.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/bar/init.fish b/test/fixtures/source/bar/init.fish new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/source/bar/man/man1/bar.1 b/test/fixtures/source/bar/man/man1/bar.1 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man1/bar.1 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man2/bar.2 b/test/fixtures/source/bar/man/man2/bar.2 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man2/bar.2 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man3/bar.3 b/test/fixtures/source/bar/man/man3/bar.3 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man3/bar.3 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man4/bar.4 b/test/fixtures/source/bar/man/man4/bar.4 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man4/bar.4 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man5/bar.5 b/test/fixtures/source/bar/man/man5/bar.5 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man5/bar.5 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man6/bar.6 b/test/fixtures/source/bar/man/man6/bar.6 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man6/bar.6 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man7/bar.7 b/test/fixtures/source/bar/man/man7/bar.7 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man7/bar.7 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man8/bar.8 b/test/fixtures/source/bar/man/man8/bar.8 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man8/bar.8 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/bar/man/man9/bar.9 b/test/fixtures/source/bar/man/man9/bar.9 new file mode 100644 index 0000000..ae0e301 --- /dev/null +++ b/test/fixtures/source/bar/man/man9/bar.9 @@ -0,0 +1,8 @@ +bar +bar +bar +bar +bar +bar +bar +bar diff --git a/test/fixtures/source/baz/baz.config.fish b/test/fixtures/source/baz/baz.config.fish new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/source/baz/baz.fish b/test/fixtures/source/baz/baz.fish new file mode 100644 index 0000000..1e55b80 --- /dev/null +++ b/test/fixtures/source/baz/baz.fish @@ -0,0 +1,3 @@ +function baz + echo baz +end diff --git a/test/fixtures/source/baz/completions/baz.fish b/test/fixtures/source/baz/completions/baz.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/baz/completions/baz.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/baz/functions/baz.func.fish b/test/fixtures/source/baz/functions/baz.func.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/baz/functions/baz.func.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/baz/init.fish b/test/fixtures/source/baz/init.fish new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/source/baz/man/man1/baz.1 b/test/fixtures/source/baz/man/man1/baz.1 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man1/baz.1 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man2/baz.2 b/test/fixtures/source/baz/man/man2/baz.2 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man2/baz.2 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man3/baz.3 b/test/fixtures/source/baz/man/man3/baz.3 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man3/baz.3 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man4/baz.4 b/test/fixtures/source/baz/man/man4/baz.4 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man4/baz.4 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man5/baz.5 b/test/fixtures/source/baz/man/man5/baz.5 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man5/baz.5 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man6/baz.6 b/test/fixtures/source/baz/man/man6/baz.6 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man6/baz.6 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man7/baz.7 b/test/fixtures/source/baz/man/man7/baz.7 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man7/baz.7 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man8/baz.8 b/test/fixtures/source/baz/man/man8/baz.8 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man8/baz.8 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/baz/man/man9/baz.9 b/test/fixtures/source/baz/man/man9/baz.9 new file mode 100644 index 0000000..829ca28 --- /dev/null +++ b/test/fixtures/source/baz/man/man9/baz.9 @@ -0,0 +1,8 @@ +baz +baz +baz +baz +baz +baz +baz +baz diff --git a/test/fixtures/source/foo/completions/foo.fish b/test/fixtures/source/foo/completions/foo.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/foo/completions/foo.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/foo/foo.config.fish b/test/fixtures/source/foo/foo.config.fish new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/source/foo/foo.fish b/test/fixtures/source/foo/foo.fish new file mode 100644 index 0000000..83659fa --- /dev/null +++ b/test/fixtures/source/foo/foo.fish @@ -0,0 +1,3 @@ +function foo + echo foo +end diff --git a/test/fixtures/source/foo/functions/foo.func.fish b/test/fixtures/source/foo/functions/foo.func.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/foo/functions/foo.func.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/foo/init.fish b/test/fixtures/source/foo/init.fish new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/fixtures/source/foo/init.fish @@ -0,0 +1 @@ + diff --git a/test/fixtures/source/foo/man/man1/foo.1 b/test/fixtures/source/foo/man/man1/foo.1 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man1/foo.1 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man2/foo.2 b/test/fixtures/source/foo/man/man2/foo.2 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man2/foo.2 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man3/foo.3 b/test/fixtures/source/foo/man/man3/foo.3 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man3/foo.3 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man4/foo.4 b/test/fixtures/source/foo/man/man4/foo.4 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man4/foo.4 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man5/foo.5 b/test/fixtures/source/foo/man/man5/foo.5 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man5/foo.5 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man6/foo.6 b/test/fixtures/source/foo/man/man6/foo.6 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man6/foo.6 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man7/foo.7 b/test/fixtures/source/foo/man/man7/foo.7 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man7/foo.7 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man8/foo.8 b/test/fixtures/source/foo/man/man8/foo.8 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man8/foo.8 @@ -0,0 +1 @@ +foo diff --git a/test/fixtures/source/foo/man/man9/foo.9 b/test/fixtures/source/foo/man/man9/foo.9 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/test/fixtures/source/foo/man/man9/foo.9 @@ -0,0 +1 @@ +foo diff --git a/test/helpers/create_mock_source.fish b/test/helpers/create_mock_source.fish deleted file mode 100644 index 799d6b6..0000000 --- a/test/helpers/create_mock_source.fish +++ /dev/null @@ -1,28 +0,0 @@ -function create_mock_source -a path - set -e argv[1] - - for name in $argv - if not mkdir -p $path/$name/{,functions,completions,man} - return 1 - end - - echo "function $name; end;" >> $path/$name/$name.fish - echo > $path/$name/functions/$name.func.fish - echo > $path/$name/completions/$name.fish - - for n in (seq 9) - mkdir -p $path/$name/man/man$n - echo $name >> $path/$name/man/man$n/$name.$n - end - - git -C $path/$name init --quiet - - git -C $path/$name config user.email "man@fisher" - git -C $path/$name config user.name "fisherman" - - git -C $path/$name add -A > /dev/null - git -C $path/$name commit -m "add $name.fish" > /dev/null - - printf "$name\nfile://$path/$name\n$name's plugin\nt a g s\n@$name\n\n" - end -end diff --git a/test/helpers/fisher_mock_config.fish b/test/helpers/fisher_mock_config.fish new file mode 100644 index 0000000..b648157 --- /dev/null +++ b/test/helpers/fisher_mock_config.fish @@ -0,0 +1,5 @@ +function fisher_mock_config -a path index + set -g fisher_config $path/config + set -g fisher_cache $fisher_config/cache + set -g fisher_index "file://$index" +end diff --git a/test/helpers/fisher_mock_index.fish b/test/helpers/fisher_mock_index.fish new file mode 100644 index 0000000..4145c2a --- /dev/null +++ b/test/helpers/fisher_mock_index.fish @@ -0,0 +1,5 @@ +function fisher_mock_index + for name in $argv[2..-1] + printf "$name\nfile://$argv[1]/$name\ninfo\ntag1 tag2\n@$name\n\n" + end +end diff --git a/test/helpers/fisher_mock_repos.fish b/test/helpers/fisher_mock_repos.fish new file mode 100644 index 0000000..ea30628 --- /dev/null +++ b/test/helpers/fisher_mock_repos.fish @@ -0,0 +1,9 @@ +function fisher_mock_repos + for name in $argv + git -C $name init --quiet + git -C $name config user.email "git@fisherman" + git -C $name config user.name "fisherman" + git -C $name add -A > /dev/null + git -C $name commit -m "$name" > /dev/null + end +end diff --git a/test/install.fish b/test/install.fish index c123df8..126d459 100644 --- a/test/install.fish +++ b/test/install.fish @@ -1,66 +1,75 @@ -source $DIRNAME/helpers/create_mock_source.fish +source $DIRNAME/helpers/fisher_mock_repos.fish +source $DIRNAME/helpers/fisher_mock_index.fish +source $DIRNAME/helpers/fisher_mock_config.fish set -l path $DIRNAME/$TESTNAME.test(random) -set -l source $path/source -set -l index $path/index -set -l names foo bar +set -l source $DIRNAME/fixtures/source +set -l index $path/INDEX +set -l names foo bar baz function -S setup - if not mkdir -p $path - return 1 - end + mkdir -p $path - set -g fisher_config $path/config - set -g fisher_cache $fisher_config/cache - set -g fisher_index "file://$index" + fisher_mock_repos $source/* + fisher_mock_index $source $names > $index + fisher_mock_config $path $index - create_mock_source $source $names > $index + fisher install $names[1] file://$source/$names[2..3] -q end function -S teardown rm -rf $path + rm -rf $source/{$names}.git +end + +test "install creates config directory if there is none" + -d $fisher_config +end + +test "install creates cache directory if there is none" + -d $fisher_cache +end + +test "adds installed plugins to fishfile" + (cat $fisher_config/fishfile | xargs) = "$names" +end + +test "downloads plugin repos to cache" + (fisher --cache=base) = $names +end + +test "download INDEX copy to the cache" + (cat $fisher_cache/.index) = (fisher_mock_index $source $names) +end + +test "add completions/.fish to completions directory" + (ls $fisher_config/completions) = {$names}.fish end for name in $names - test "install by name:<$name>" ( - fisher install $name --quiet - ls $fisher_cache - - ) = $name + test "add .fish to functions/$name.fish directory" + -e $fisher_config/functions/$name.fish end - test "install by url:" ( - fisher install file://$source/$name --quiet - ls $fisher_cache + for file in $fisher_cache/$name/functions/*.fish + test "add functions/*.fish to functions/"(basename $file) + -e $fisher_config/functions/(basename $file) + end + end - ) = $name + test "add config files to conf.d" + -e $fisher_config/conf.d/$name.config.fish + end + + test "add init files to conf.d as .init.config" + -e $fisher_config/conf.d/$name.init.config.fish + end + + test "add manual pages to config/man/" + -d $fisher_config/man end end -test "install several" - (printf "%s\n" $names) = ( - - fisher install $names --quiet - ls $fisher_cache) -end - -test "install from " - (printf "%s\n" $names) = ( - - printf "%s\n" $names | fisher install --quiet - ls $fisher_cache) -end - -test "install updates fishfile" - "$names" = ( - - fisher install $names --quiet - xargs < $fisher_config/fishfile) -end - -test "fail install package by name" - "fisher: 'what' not found" = ( - - fisher install "what" ^&1 - echo $status) +test "install returns 1 if package can't be installed" + (fisher install -q -- "what"; echo $status) = 1 end diff --git a/test/other.fish b/test/other.fish index 3b5f3ef..0247f18 100644 --- a/test/other.fish +++ b/test/other.fish @@ -3,17 +3,17 @@ test "display help help" end test "display install help" - (fisher install --help | xargs) = "usage: fisher install [ ...] [--quiet] [--help] -q --quiet Enable quiet mode -h --help Show usage help" + (fisher install --help | xargs) = "usage: fisher install [ ...] [--quiet] [--help] -q --quiet Enable quiet mode -h --help Show usage help" end test "display search help" - (fisher search --help | xargs) = "usage: fisher search [] [--select=] [--field=] [--or|--and] [--quiet] [--help] -s --select= Select all, cache or remote plugins -f --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" + (fisher search --help | xargs) = "usage: fisher search [] [--select=] [--field=] [--or|--and] [--quiet] [--help] -s --select= Select all, cache or remote plugins -f --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 [ ...] [--all] [--force] [--quiet] [--help] -a --all Uninstall all plugins -f --force Delete copy from cache -q --quiet Enable quiet mode -h --help Show usage help" + (fisher uninstall --help | xargs) = "usage: fisher uninstall [ ...] [--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 [ ...] [--self] [--cache] [--path=] [--quiet] [--help] -s --self Update Fisherman -c --cache Update cached plugins --path= Update repository at given path -q --quiet Enable quiet mode -h --help Show usage help" + (fisher update --help | xargs) = "usage: fisher update [ ...] [--me] [--quiet] [--help] -m --me Update Fisherman -q --quiet Enable quiet mode -h --help Show usage help" end diff --git a/test/uninstall.fish b/test/uninstall.fish index 0457fa2..a9b1a02 100644 --- a/test/uninstall.fish +++ b/test/uninstall.fish @@ -1,120 +1,48 @@ -source $DIRNAME/helpers/create_mock_source.fish +source $DIRNAME/helpers/fisher_mock_repos.fish +source $DIRNAME/helpers/fisher_mock_index.fish +source $DIRNAME/helpers/fisher_mock_config.fish set -l path $DIRNAME/$TESTNAME.test(random) -set -l source $path/source -set -l index $path/index -set -l names foo bar +set -l source $DIRNAME/fixtures/source +set -l index $path/INDEX +set -l names foo bar baz function -S setup - if not mkdir -p $path - return 1 - end + mkdir -p $path - set -g fisher_config $path/config - set -g fisher_cache $fisher_config/cache - set -g fisher_index "file://$index" + fisher_mock_repos $source/* + fisher_mock_index $source $names > $index + fisher_mock_config $path $index - create_mock_source $source $names > $index - - fisher install $names --quiet + fisher install $names -q + fisher uninstall $names -q end function -S teardown rm -rf $path + rm -rf $source/{$names}.git end for name in $names - test "uninstall <$name> does not clear cache" - (printf "%s\n" $names) = ( - - fisher uninstall $name --quiet - ls $fisher_cache) + test "remove plugin from functions/$name.fish" + ! -e $fisher_config/functions/$name.fish end - test "uninstall --force clears package <$name> from cache" - (for _name in $names - if test $_name != $name - printf "%s\n" $_name - end - end) = ( - - fisher uninstall $name --quiet --force - ls $fisher_cache) + test "remove plugin from completions/$name.fish" + ! -e $fisher_config/completions/$name.fish end - test "uninstall <$name> removes functions/$name.fish" - ( - echo 0 - echo 1 - ) = ( - - builtin test -f $fisher_config/functions/$name.fish - echo $status - - fisher uninstall $name --quiet - - builtin test -f $fisher_config/functions/$name.fish - echo $status) + test "remove plugin from conf.d/$name.config.fish" + ! -e $fisher_config/conf.d/$name.config.fish end - test "uninstall <$name> removes completions/$name.fish" - ( - echo 0 - echo 1 - ) = ( - - builtin test -f $fisher_config/completions/$name.fish - echo $status - - fisher uninstall $name --quiet - - builtin test -f $fisher_config/completions/$name.fish - echo $status) - end - - test "uninstall <$name> removes man/man.../$name..." - ( - for n in (seq 9) - echo 0 - end - - for n in (seq 9) - echo 1 - end - ) = ( - - for n in (seq 9) - builtin test -f $fisher_config/man/man$n/$name.$n - echo $status - end - - fisher uninstall $name --quiet - - for n in (seq 9) - builtin test -f $fisher_config/man/man$n/$name.$n - echo $status - end) + test "remove plugin from conf.d/$name.init.config.fish" + ! -e $fisher_config/conf.d/$name.init.config.fish end end -test "remove all installed/enabled plugins" - -z ( - - fisher uninstall --all --quiet - ls $fisher_config/functions - ls $fisher_config/completions) -end - -test "remove all installed plugins flushing cache" - -z ( - - fisher uninstall --all --force --quiet - ls $fisher_cache) -end - -test "uninstall updates fishfile" - "$names[2..-1]" = ( - - fisher uninstall $names[1] --quiet - cat $fisher_config/fishfile | xargs) +test "remove plugin manual from man/man%" + (for file in $fisher_config/man/** + basename $file + end | xargs) = (echo {man}(seq 9) | xargs) end diff --git a/test/update-self.fish b/test/update-self.fish deleted file mode 100644 index df47003..0000000 --- a/test/update-self.fish +++ /dev/null @@ -1,36 +0,0 @@ -source $DIRNAME/helpers/create_mock_source.fish - -set -l path $DIRNAME/$TESTNAME.test(random) -set -l server $path/server -set -l home fisherman - -function -S setup - set -g fisher_home $path/home - - if not mkdir -p $fisher_home - return 1 - end - - create_mock_source $server $home > /dev/null - - git -C $fisher_home init --quiet - git -C $fisher_home remote add origin $server/$home/.git -end - -function -S teardown - rm -rf $path -end - -test "update itself w/ --self" - (ls $server/$home) = ( - - fisher update --self --quiet ^/dev/null - ls $fisher_home) -end - -test "update repo at given path via git pull" - (ls $server/$home) = ( - - fisher update --path=$fisher_home --quiet ^/dev/null - ls $fisher_home) -end diff --git a/test/update.fish b/test/update.fish index 8b8d4da..723cd7d 100644 --- a/test/update.fish +++ b/test/update.fish @@ -1,64 +1,53 @@ -source $DIRNAME/helpers/create_mock_source.fish +source $DIRNAME/helpers/fisher_mock_repos.fish +source $DIRNAME/helpers/fisher_mock_index.fish +source $DIRNAME/helpers/fisher_mock_config.fish set -l path $DIRNAME/$TESTNAME.test(random) -set -l source $path/source -set -l index $path/index -set -l names foo -set -l extra norf +set -l source $DIRNAME/fixtures/source +set -l source2 $path/source +set -l index $path/INDEX +set -l names foo bar baz +set -l names2 norf function -S setup - if not mkdir -p $path - return 1 + mkdir -p $path + + fisher_mock_repos $source/* + fisher_mock_index $source $names > $index + fisher_mock_config $path $index + + fisher install $names -q + + mkdir -p $source2 + + cp -rf $source $path + + for name in $names + set -l file $source2/$name/$name.fish + sed "s/echo $name/echo $name v2/" $file > $file.tmp + mv $file.tmp $file + + fisher_mock_repos $source2/$name + + git -C $fisher_cache/$name remote rm origin + git -C $fisher_cache/$name remote add origin file://$source2/$name end - set -g fisher_config $path/config - set -g fisher_cache $fisher_config/cache - set -g fisher_index "file://$index" - - create_mock_source $source $names > $index - fisher install $names --quiet - - # Updates the source repos duplicating the original content. - # See helpers/create_mock_source.fish - - create_mock_source $source $names $extra > $index + fisher_mock_index $source $names $names2 > $index end function -S teardown rm -rf $path + rm -rf $source/{$names}/.git end for name in $names - test "update <$name> package copy in cache" - (functions $name $name | xargs) = ( - - fisher update $name --quiet - fish_indent < $fisher_cache/$name/$name.fish | xargs) - end - - test "install <$name> if update is successful" - (functions $name $name | xargs) = ( - - fisher update $name --quiet - fish_indent < $fisher_config/functions/$name.fish | xargs) + test "update <$name> in cache" ( + fisher update $name -q + eval $name) = "$name v2" end end -test "update packages via " - (functions $names $names | xargs) = ( - - printf "%s\n" $names | fisher update --quiet - cat $fisher_config/functions/{$names}.fish | fish_indent | xargs) -end - -test "update cache" - (functions $names $names | xargs) = ( - - fisher update --cache --quiet - cat $fisher_config/functions/{$names}.fish | fish_indent | xargs) -end - -test "update index with --index using contents in \$fisher_index" ( - fisher update --index --quiet - awk -F'\n' -v RS='' '{ print $1 }' $fisher_cache/.index) = $names $extra +test "update index" + (fisher update --index; cat $fisher_config/cache/.index) = (cat $index) end