Skip to content

Commit

Permalink
Merge pull request #30 from fisherman/v030
Browse files Browse the repository at this point in the history
Ahoy! Fisherman 0.3.0
  • Loading branch information
jorgebucaran committed Jan 7, 2016
2 parents 8330c3e + aed8166 commit 8bfdf82
Show file tree
Hide file tree
Showing 52 changed files with 696 additions and 457 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Authors
* Jorge Bucaran <[[email protected]](mailto:[email protected])>
* Hyeon Kim <[[email protected]](mailto:[email protected])>
94 changes: 86 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,92 @@
# Change Log

* [0.3.0](#030)
* [0.2.0](#020)
* [0.1.0](#010)

## 0.2.0 - 2016-01-05

* Improved README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors.
## [0.3.0][v030] - 2016-01-05

* :warning: Removed `fisher update --cache` in favor of `fisher --cache | fisher update` and `fisher uninstall --all` in favor of `fisher --cache | fisher uninstall`.
> This release contains several breaking changes a few major improvements. The good news is that the API is starting to look more stable and very unlikely to change drastically again in the future.
### Fixes

* Fix a critical bug in the Makefile that was incorrectly merging any existing user configuration file and the generated Fisherman configuration. Closes #21.

* Fix a bug in install and uninstall that was adding plugin names to fishfiles instead of the URL when interacting with custom URLs. Probably closes #23.

* Fix a bug in install, update and uninstall that was displaying an incorrect plugin count if there was at least on failure.

* Fix bug in `fisher install` that causes install to fail even though it succeeds, due to `wait(1)`'s behavior of returning `1` if there is any output to standard error. Closes #20.

* Fix bug in `fisher uninstall` that was removing plugins from the cache by mistake.

### Add

* Add feature to Makefile to download the index for the first time in order to provide auto-complete before the user can install/update/search, actions which would case the index to be updated.

* Add link to Slack [room][wharf] in README. Thanks @simnalamburt.

* Add new `$fisher_timeout` configuration variable that lets you specify `curl(1)` `--max-time` option. Without this, `curl` could hang for a long time if you are in a bad connection.

* Add `fisher install --link` to allow installing plugins creating a symbolic link to each of the relevant files to be copied during the install process. If you use ***`--link`*** to install a plugin that is a _path to a directory_ or file, a symbolic link to the directory will be created making local testing more convenient as you are not required to update the plugin's repository to test changes within Fisherman. If you are testing using [Fishtape][fishtape] you do not even need to reset the shell session.

* Add `fisher --alias[=<command>=<alias>]` to simplify creating new aliases for `fisher` commands. Use `fisher --alias` without arguments to list the current set of aliases. Also add auto-complete for aliases to install, update or uninstall. Note that aliases are **not** persisted this way. To save your aliases use `$fisher_alias` as described in `fisher help config`. Also note that aliases are only auto-complete if you call `fisher --alias`. To auto-complete aliases saved to `$fisher_alias` you can do `fisher --alias (fisher --alias)`.

* Add short options for new and old fisher flags:

* `--file``-f`
* `--list``-l`
* `--alias``-a`

### Improvements

* Improve help message for failed installs. Closes ##24. @namandistro

* Improve `fisher --validate` to automatically correct common misspellings, for example when installing a oh-my-fish package, one often types ohmyifsh.

* :point_up: Improve auto-complete performance by extracting the implementation of the different `fisher` flags to `__fisher_*` functions. `completions/fisher.fish` relies heavily in `fisher_search` to query what plugins are available to install/update/uninstall. In this process, numerous calls to `fisher --list` and `fisher --validate`, etc., are made. Now, auto-complete does not have to pay the penalty of entering `fisher`, parsing options, etc. Closes #27. @namandistro

* Improve `fisher --help` output and show up until now poorly documented ***`--list`***, ***`--file`***, etc. flags consistently. Also display available commands after `make install` to improve usability.

* Improve `fisher install` so that it checks whether the plugin you are trying to install, if it is already in the cache, is a symbolic link or not, and installs it as if the `--link` flag was specified.

* Improve `fisher --validate` to retrieve the absolute path to the closest directory of the given items if they are valid local paths. Related #19.

* Improve install to not `git clone` local plugins if a regular `path/to/file` is given to `fisher install`. Instead, copy to the cache using `cp(1)` and if `--link` is used, create a symlink.

* Improve `fisher --validate` to invalidate items with repeated `.` and `-` and allow items that begin with `/` or `./` to support installing plugins from local paths. Related #19.

## :warning: Remove / Rename

* Modify `fisher update` default behavior. Now this command updates Fisherman by default. Use of `--self` and `--me` is also **deprecated**. To read from the standard input use a dash `-`. For example: `fisher --list | fisher update -`. See [Usage of dash in place of a filename](http://unix.stackexchange.com/questions/16357/usage-of-dash-in-place-of-a-filename/16364#16364). Closes #25.

* Rename `--cache` to more descriptive ***`--list`***. Thanks @colstrom.

* Remove `fisher --cache=base` and make it return the base names of all directories in the path by default. To get the full path use printf `printf "$fisher_cache/%s" (fisher --list)`

* Rename undocumented `fisher --translate` flag (again) to `fisher --cache`. This function reads the standard input for a name, URL or local path and calculates the plugin's path relative to the cache. For a name this is simple `$fisher_cache/<name>` for an URL, retrieve the remote URL of every repository until there is a match with the given URL and return the path in the cache of that repository. Finally, if the input is a

* Revert #3. The reason `getopts.fish` was in its own file originally is because @bucaran wanted a standalone, dependency free cli parser solution, arguably slightly faster than having Awk read `getopts.awk` for each use. The performance improvement is negligible at best, but `getopts` is also used by every single command and future commands and plugins are very likely to use it as well, so we might as well use the slightly faster version.


## [0.2.0][v020] - 2016-01-05

* Improve README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors.

* :warning: Remove `fisher update --cache` in favor of `fisher --list | fisher update` and `fisher uninstall --all` in favor of `fisher --list | fisher uninstall`.

* :warning: Fisherman does not move initialization / configuration files following the convention `name`.config.fish to `$fisher_config/functions`, but to `$fisher_config/conf.d` now and evaluates each `*.config.fish` inside at shell start as usual. Closes #13.

* Added `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`. Closes #11.
* ~~Add `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`~~. Closes #11.

* Fisherman now generates information about plugins installed via custom URLs. For the description, a shortened version of the URL is used. For the URL the full URL is used. For tags, the URL is fuzzily checked and tags such as _theme_, _plugin_, _config_ and _omf_ are added. The tag _orphan_ is added by default as well. Finally, the author is generated by retrieving the e-mail or username of the author of the first commit in the plugin's repository. Closes #9 and #14.

* Changed `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8.
* ~~Change `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8.~~

* Fixed a bug with `mktemp` failing on some systems. Closes #7. Thanks @tobywf.
* Fix a bug where `mktemp` would fail in some systems. Closes #7. Thanks @tobywf.

* Added [CODE_OF_CONDUCT][code_of_conduct]. Closes #6.
* Add [CODE_OF_CONDUCT][code_of_conduct]. Closes #6.

* Fisherman can now unload themes within the same shell, without having to restart the session. Closes #5.

Expand All @@ -29,7 +96,8 @@

* Support dots inside URIs in `fisher --validate`. Closes #2.

* Refactored and improved tests for `install`, `update` and `uninstall`.
* Refactor and improve tests for `install`, `update` and `uninstall`.


## [0.1.0][v010] - 2016-01-01

Expand All @@ -40,6 +108,16 @@

<!-- Links -->

[v030]: https://

[v020]: https://github.com/fisherman/fisherman/commit/54212e1cbce66c7671baa045653efe912dbb4b77

[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

[fishtape]: https://github.com/fisherman/fishtape

[wharf]: http://fisherman-wharf.herokuapp.com/
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ MAN5 := $(wildcard $(MAN)/man5/*.md)
MAN7 := $(wildcard $(MAN)/man7/*.md)
DOCS := $(MAN1:%.md=%.1) $(MAN5:%.md=%.5) $(MAN7:%.md=%.7)

INDEX := $(FISHER_CACHE)/.index

AUTHORS = $(FISHER_HOME)/AUTHORS.md
VERSION = `cat $(FISHER_HOME)/VERSION`

Expand All @@ -22,7 +24,12 @@ TILDEIFY = sed "s|$$HOME|~|"
.PHONY: all test flush uninstall release

all: $(FISH_CONFIG) $(FISHER_CACHE) $(AUTHORS) $(DOCS)
@$(call MSG,"Reset your shell to apply changes")
@if [ ! -s $(INDEX) ]; then\
echo "Downloading the index for the first time...";\
fish -c "fisher_update --index";\
fi
@$(call MSG,"Reset your shell and type 'fisher <command>' to use Fisherman.")
@fish -c "fisher -h" | sed -n '5,$$p'

test:
@fish -c "fishtape test/*.fish"
Expand All @@ -35,7 +42,7 @@ uninstall:
@sed -E '/set (fisher_home|fisher_config) /d;/source \$$fisher_home/d' \
$(FISH_CONFIG) > $(FISH_CONFIG).tmp
@mv $(FISH_CONFIG).tmp $(FISH_CONFIG)
@$(call MSG,"Reset your shell to apply changes")
@$(call MSG,"Reset your shell to apply changes.")

release: $(FISHER_HOME)
@if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\
Expand All @@ -56,7 +63,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 'FNR==NR{ print; a[$$0]; next } !($$0 in a) || /^$$/' $@.fisher $@ > $@.tmp
@mv $@.tmp $@ && rm $@.fisher

$(FISHER_CACHE):
Expand All @@ -69,4 +76,5 @@ $(AUTHORS): $(FISHER_HOME)
sed -E 's/([^<>]+)<([^<>]*)>/* \1 \&lt;[\2](mailto:\2)\&gt;/' >> $@

%.1 %.5 %.7: %.md
@ronn --manual=fisherman --roff $? 2>&1 | sed 's/^ *roff: *//;s|//|/|g'
@echo "Creating the documentation..."
-@ronn --manual=fisherman --roff $? 1>&2 2> /dev/null
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ See [`fisherman(1)`][fisherman-1] and [`fisherman(7)`][fisherman-7] for usage an
[fisherman-7]: man/man7/fisher.md
[travis-link]: https://travis-ci.org/fisherman/fisherman
[travis-badge]: https://img.shields.io/travis/fisherman/fisherman.svg?style=flat-square
[fisherman-version]: https://img.shields.io/badge/fisherman-v0.2.0-00B9FF.svg?style=flat-square
[fisherman-version]: https://img.shields.io/badge/fisherman-v0.3.0-00B9FF.svg?style=flat-square
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.3.0
18 changes: 6 additions & 12 deletions completions/fisher.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ complete -c fisher -n "__fish_seen_subcommand_from search" -a "\t"
complete -c fisher -n "__fish_use_subcommand" -s v -l version -d "Show version information"
complete -c fisher -n "__fish_use_subcommand" -s h -l help -d "Display help"
complete -c fisher -n "__fish_use_subcommand" -s f -l file -d "Read fishfile"
complete -c fisher -n "__fish_use_subcommand" -s a -l alias -d "Define one or more comma-separated command aliases"
complete -c fisher -n "__fish_use_subcommand" -s l -l list -d "List plugins in the cache"

set -l index $fisher_cache/.index
set -l IFS ";"

for option in commands guides
fisher help --$option=bare | sed -E 's/^ *([^ ]+) *(.*)/\1;\2/' | while read -l func info
fisher_help --$option=bare | sed -E 's/^ *([^ ]+) *(.*)/\1;\2/' | while read -l func info

complete -c fisher -n "__fish_seen_subcommand_from help" -a $func -d "$info"

Expand All @@ -18,20 +19,13 @@ for option in commands guides

complete -c fisher -n "__fish_use_subcommand" -a $func -d "$info"

fisher_help --usage=$func | __fish_parse_usage OFS=';' | while read -l 1 2 3
fisher_help --usage=$func | __fisher_complete OFS=';' | while read -l 1 2 3
complete -c fisher -n "__fish_seen_subcommand_from $func" -s "$3" -l "$2" -d "$1"
end
end
end

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
__fisher_complete_cache update uninstall
__fisher_complete_remote install
end
2 changes: 1 addition & 1 deletion completions/wait.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ complete -xc wait -d "Run commands and wait with a spin"
complete -xc wait -n "not __fish_seen_subcommand_from --spin" -a "\t"

set -l IFS \t
wait --help | __fish_parse_usage | while read -l 1 2 3
wait --help | __fisher_complete | while read -l 1 2 3
complete -c wait -s "$3" -l "$2" -d "$1"
end
2 changes: 2 additions & 0 deletions config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set fisher_index https://raw.githubusercontent.com/fisherman/fisher-index/master

set fisher_error_log $fisher_cache/.debug_log

set fisher_timeout 5

set fish_function_path {$fisher_config,$fisher_home}/functions $fish_function_path
set fish_complete_path {$fisher_config,$fisher_home}/completions $fish_complete_path

Expand Down
35 changes: 35 additions & 0 deletions functions/__fisher_alias.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function __fisher_alias -a value -d "Define one or more comma-separated command aliases."
switch "$value"
case ""
if test -z "$fisher_alias"
return 1
end

printf "%s\n" $fisher_alias | sed 's/[=,]/ /g'

case \*
for value in $argv
if contains -- $fisher_alias $value
continue
end

set -g fisher_alias $fisher_alias $value

set -l index $fisher_cache/.index

if not test -e $index
continue
end

for alias in (__fisher_alias)
switch $alias
case install\*
__fisher_complete_remote $alias

case update\* uninstall\*
__fisher_complete_cache $alias
end
end
end
end
end
20 changes: 20 additions & 0 deletions functions/__fisher_cache.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function __fisher_cache -d "Calculate path of a name, url or path relative to the cache"
while read --prompt="" -l item
switch "$item"
case file:///\*
printf "%s\n" $item

case \*/\*
for file in $fisher_cache/*
switch "$item"
case (git -C $file ls-remote --get-url | __fisher_validate)
printf "%s\n" $file
break
end
end

case \*
printf "%s\n" $fisher_cache/$item
end
end
end
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
function __fish_parse_usage -d "Parse usage help output"
switch "$argv[1]"
case -h --help
printf "Usage\n"
printf " __fish_parse_usage [awk_var=value] [--help]\n\n"

printf "Example\n"
printf " set -l IFS \\\t\n"
printf " STDIN | __fish_parse_usage | while read -l d l s\n"
printf " complete -c <command> -s $s -l $l -d $d\n"
printf " end\n"
return
end
# Usage
# __fisher_complete [awk_var=value] [--help]
#
# Example
# set -l IFS \t
# STDIN | __fisher_complete | while read -l d l s
# complete -c <command> -s -l -d
# end

function __fisher_complete -d "Parse usage help output"
switch "$argv"
case \*OFS=\*
case \*
Expand Down
7 changes: 7 additions & 0 deletions functions/__fisher_complete_cache.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function __fisher_complete_cache -d "Add auto-complete for cached plugins"
set -l IFS ";"
fisher_search --index=$fisher_cache/.index --select=cache --name --info \
| while read -l name info
complete -c fisher -n "__fish_seen_subcommand_from $argv" -a "$name" -d "$info"
end
end
7 changes: 7 additions & 0 deletions functions/__fisher_complete_remote.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function __fisher_complete_remote -d "Add auto-complete for remote plugins"
set -l IFS ";"
fisher_search --index=$fisher_cache/.index --select=remote --name --info \
| while read -l name info
complete -c fisher -n "__fish_seen_subcommand_from $argv" -a "$name" -d "$info"
end
end
19 changes: 19 additions & 0 deletions functions/__fisher_file.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function __fisher_file -a file -d "Read a fishfile and display its contents"
switch "$file"
case ""
set file $fisher_config/fishfile

case "-"
set file /dev/stdin
end

awk '
!/^ *(#.*)*$/ {
gsub("#.*", "")
if (/^ *package .+/) $1 = $2
if (!duplicates[$1]++) printf("%s\n", $1)
}
' $file
end
7 changes: 7 additions & 0 deletions functions/__fisher_list.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function __fisher_list -d "List plugins in the cache"
for file in $fisher_cache/*
if test -d $file
basename $file
end
end
end
3 changes: 3 additions & 0 deletions functions/__fisher_name.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function __fisher_name -d "Generate a pretty name from a plugin path or URL"
sed -E 's|.*/(.*)|\1|; s/^(plugin|theme|pkg|omf|fish|fisher)-//'
end
Loading

0 comments on commit 8bfdf82

Please sign in to comment.