diff --git a/CHANGELOG.md b/CHANGELOG.md
index e63649b..29537a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,15 @@
# Change Log
+## [1.4.0][v140] - 2016-03-14
+
+* :zap: Fisherman updates plugins in parallel now. Performance will vary, but chances are you will perceive 3 to 10 times faster updates.
+
+![para](https://cloud.githubusercontent.com/assets/8317250/13730493/5b704bec-e994-11e5-81b9-d3af2c0f9821.gif)
+
+* Deprecate fisher list file in favor of fisher list - < file
+
+* Revise documentation.
+
## [1.3.1][v131] - 2016-03-12
* Fix bug in fisher_config_color_reset not declaring path variable.
diff --git a/README.md b/README.md
index e90a32f..9562d6f 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ curl -sL get.fisherman.sh | fish
[![play]][play-link]
-If you don't have Fish, you need to install it too. Install instructions can be found here.
+Install instructions for fish can be found here.
## Install
@@ -41,37 +41,43 @@ The Fisherman CLI consists of: *install*, *update*, *uninstall*, *list*, *search
* Install plugins.
```
-fisher install fishtape shark get
+fisher i fishtape shark get bobthefish
+```
+
+* Install Oh My Fish! plugins.
+
+```fish
+fisher i omf/plugin-{percol,jump,fasd}
```
* Install a plugin from a local directory.
```fish
-fisher install ./path/to/plugin
+fisher i ./path/to/plugin
```
-* Install a plugin from a URL.
+* Install a plugin from various URLs.
```fish
-fisher install owner/repo
+fisher i https://github.com/some/plugin another/plugin bb:one/more
```
-* Install a plugin from a Gist URL.
+* Install a plugin from a Gist.
```fish
-fisher install gist.github.com/owner/1f40e1c6e0551b2666b2
+fisher i gist.github.com/owner/1f40e1c6e0551b2666b2
```
-* Update Fisherman.
+* Update everything.
```
-fisher update
+fisher u
```
* Update plugins.
```
-fisher update shark get
+fisher u shark get
```
* Uninstall plugins.
@@ -80,16 +86,10 @@ fisher update shark get
fisher uninstall fishtape debug
```
-* Uninstall plugins and remove them from the cache.
+* Get help.
```fish
-fisher uninstall fishtape debug -f
-```
-
-* Show the documentation.
-
-```fish
-fisher help
+fisher h
```
## List and search
@@ -123,31 +123,37 @@ fisher search
...
```
-Get detailed information about a plugin.
+Query the index using regular expressions.
```
-fisher search shellder
-> shellder by simnalamburt
-Powerline prompt optimized for speed
-github.com/simnalamburt/shellder
+fisher search --name~/git-is/
+git-is-dirty Test if there are changes not staged for commit
+git-is-empty Test if a repository is empty
+git-is-repo Test if the current directory is a Git repo
+git-is-staged Test if there are changes staged for commit
+git-is-stashed Test if there are changes in the stash
+git-is-touched Test if there are changes in the working tree
```
-Search plugins using tags.
+Search using tags.
```
fisher search --tag={git,test}
...
-* fishtape TAP producing test runner
+ * fishtape TAP producing test runner
git-branch-name Get the name of the current Git branch
- git-is-repo Test if the current directory is a Git repo
git-is-dirty Test if there are changes not staged for commit
+ git-is-empty Test if a repository is empty
+ git-is-repo Test if the current directory is a Git repo
+ git-is-staged Test if there are changes staged for commit
git-is-stashed Test if there are changes in the stash
+ git-is-touched Test if there are changes in the working tree
...
```
The legend consists of:
-* `*` The plugin is currently enabled
+* `*` The plugin is enabled
* `>` The plugin is a prompt
* `@` The plugin is a symbolic link
@@ -156,19 +162,19 @@ The legend consists of:
Fisherman commands are pipe aware. Plumb one with another to create complex functionality.
-* Update all the plugins in the cache.
+Update plugins installed as symbolic links.
```fish
-fisher list | fisher update -
+fisher list --link | fisher update -
```
-* Enable all the plugins that are currently disabled.
+Enable all the plugins currently disabled.
```fish
fisher list --disabled | fisher install
```
-* Uninstall all the plugins and remove them from the cache.
+Uninstall all the plugins and remove them from the cache.
```fish
fisher list | fisher uninstall --force
@@ -176,7 +182,7 @@ fisher list | fisher uninstall --force
## Dotfiles
-When you install a plugin, Fisherman updates a file known as the *fishfile* to track what plugins are currently enabled.
+When you install a plugin, Fisherman updates the *fishfile* to track what plugins are currently enabled.
* Customize the location of the fishfile.
@@ -211,7 +217,7 @@ $fisher_config
The index is a plain text database that lists Fisherman official plugins.
-The index is a list of records, each consisting of the following fields: *name*, *url*, *info*, one or more *tags* and *author*.
+The index lists records, each consisting the fields: *name*, *url*, *info*, one or more *tags* and *author*.
```
z
@@ -225,10 +231,10 @@ If you have a plugin you would like to submit to the index, use the submit plugi
```
fisher install submit
-fisher submit my_plugin
+fisher submit my_plugin description tags url
```
-Otherwise, submit the plugin manually by creating a pull request in the [index](https://github.com/fisherman/fisher-index) repository.
+Or, submit the plugin manually by creating a pull request in the [index](https://github.com/fisherman/fisher-index) repository.
```
git clone https://github.com/fisherman/fisher-index
@@ -239,19 +245,19 @@ git push origin master
## Variables
-* *$fisher_home*
- The home directory. If you installed Fisherman using the recommended method curl -sL install.fisherman.sh | fish, the location ought to be *XDG_DATA_HOME/fisherman*. If you clone Fisherman and run make yourself, the current working directory is used by default.
+* $fisher_home:
+ The home directory. If you installed Fisherman using the recommended method, the location ought to be *XDG_DATA_HOME/fisherman*.
-* *$fisher_config*
- The configuration directory. This is default location of the *fishfile*, *key_bindings.fish*, *cache*, *functions*, *completions* and *conf.d* directories. The default location is *XDG_CONFIG_HOME/fisherman*.
+* $fisher_config:
+ The configuration directory. This is default location of your *fishfile*, *key_bindings.fish*, *cache*, *functions*, *completions* and *conf.d* directories. *XDG_CONFIG_HOME/fisherman* by default.
-* *$fisher_file*
- See FISHFILE above.
+* $fisher_file:
+ See [fishfile](#fishfile) above.
-* *$fisher_cache*
+* $fisher_cache:
The cache directory. Plugins are downloaded to this location.
-* *$fisher_alias* *command*=*alias* ...
+* $fisher_alias *command*=*alias* ...:
Use this variable to create aliases of Fisherman commands.
## Plugins
@@ -263,26 +269,18 @@ fisher install new
fisher new plugin < meta.yml
```
-See the documentation of new for details.
+See the documentation for [new] for details.
### Utilities
Utilities are plugins that define one or more functions.
-This example walks you through creating *wtc*, a plugin based in [ngerakines/commitment](https://github/ngerakines/commitment) random commit message generator.
-
-* Create a directory and initialize a Git repository.
+Below is a plugin based in [ngerakines/commitment](https://github/ngerakines/commitment) random commit message generator.
```fish
mkdir wtc
cd wtc
-git init
-git remote add origin https://github.com//wtc
-```
-* Add the wtc function.
-
-```fish
function wtc -d "Generate a random commit message"
switch "$argv"
case -h --help
@@ -293,26 +291,16 @@ function wtc -d "Generate a random commit message"
curl -s whatthecommit.com/index.txt
end
functions wtc > wtc.fish
-```
-* Install the plugin.
-
-```fish
fisher install .
+```
+```
wtc
(\ /)
(O.o)
(> <) Bunny approves these changes.
```
-* Commit changes and push to your remote origin when you are done.
-
-```fish
-git add --all
-git commit -m "What the commit?"
-git push origin master
-```
-
### Submit
To submit wtc to the official index.
@@ -327,66 +315,20 @@ This will create a PR in the Fisherman index repository. Once the PR is approved
fisher install wtc
```
-### Completions
-
-Create a completions directory and add a completions file.
-
-```fish
-mkdir completions
-$EDITOR completions/wtc.fish
-```
-
-```fish
-complete --command wtc --short h --long help --description "Show usage help"
-```
-
-Or use `__fisher_complete` to create completions from wtc usage output.
-
-```
-wtc --help | __fisher_complete wtc
-```
-
-### Docs
-
-Create a man/man1 directory and add a man(1) page for wtc.
-
-There are utilities that can help you generate man pages from various text formats. For example, pandoc(1) and ronn(1).
-
-To create a man page manually.
-
-```
-mkdir -p man/man1
-$EDITOR man/man1/wtc.1
-```
-
-```
-.TH man 1 "Today" "1.0" "wtc man page"
-.SH NAME
-wtc \- Generate a random commit message
-.SH SYNOPSIS
-wtc [--help]
-.SH OPTIONS
--h, --help: Display help information.
-.SH SEE ALSO
-https://github.com/ngerakines/commitment
-```
-
### Dependencies
A plugin can list dependencies to other plugins using a *fishfile*.
-Create a new file in the root of your project and add the name or URL of your dependencies.
+Create a *fishfile* in the root of your project and add the name or URL of your dependencies.
-```fish
-cat > fishfile
+```
my_plugin
https://github.com/owner/another_plugin
-^D
```
### Prompts
-Prompts, also known as themes, are plugins that modify the appearance of the shell prompt and modify fish syntax colors.
+Prompts, or themes, are plugins that modify the appearance of the shell prompt and colors.
Create a `fish_prompt` function.
@@ -394,6 +336,8 @@ Create a `fish_prompt` function.
function fish_prompt
printf "%s (%s) >> " (prompt_pwd) Fisherman
end
+```
+```
~ (Fisherman) >> type here
```
@@ -410,8 +354,10 @@ Save the functions to a directory and install the prompt as a plugin.
```fish
mkdir my_prompt
cd my_prompt
+
functions fish_prompt > fish_prompt.fish
functions fish_right_prompt > fish_right_prompt.fish
+
fisher install .
```
@@ -423,7 +369,9 @@ function set_color_custom
set -U fish_color_command yellow
set -U fish_color_param white
end
+
functions set_color_custom > set_color_custom.fish
+
fisher update .
```
@@ -448,37 +396,15 @@ It's 6:30
Make it a plugin
-
```fish
fisher install fisher_time
```
-This creates a new directory fisher_time in the current working directory and installs the plugin.
-
-The following example implements a command to format plugin information into columns.
-
-```fish
-function fisher_info -d "Display information about plugins"
- switch "$argv"
- case -h --help
- printf "Usage: fisher info [...]\n\n"
- printf " -h --help Show usage help\n"
- return
- end
-
- for item in $argv
- fisher search $item --name --info
- end | sed -E 's/;/: /' | column
-end
-
-fisher install fisher_info
-```
-
### Snippets
Snippets are plugins that run code at the start of the shell. Snippets must be placed inside a sub directory named conf.d.
-The following example implements the fish_postexec hook to display the runtime of the last command in milliseconds.
+The following example implements a fish_postexec hook to display the duration of the last command in milliseconds.
```fish
mkdir -p runtime/conf.d
@@ -486,7 +412,7 @@ cd runtime
$EDITOR conf.d/fish_postexec.fish
```
-```
+```fish
function fish_postexec --on-event fish_postexec
printf "%sms\n" $CMD_DURATION > /dev/stderr
end
@@ -512,3 +438,4 @@ fisher install ./postexec
[other]: https://github.com/fisherman/fisherman/wiki/Installing-Fisherman#notes
[Fisherman]: http://fisherman.sh
+[new]: https://github.com/fishery/new
diff --git a/functions/__fisher_gist_to_name.fish b/functions/__fisher_gist_to_name.fish
index 54630d6..aedb276 100644
--- a/functions/__fisher_gist_to_name.fish
+++ b/functions/__fisher_gist_to_name.fish
@@ -1,15 +1,15 @@
-function __fisher_gist_to_name -a url
- set -l id (printf "%s\n" "$url" | sed 's|.*/||')
+function -S __fisher_gist_to_name -a url
+ set -l gist_id (printf "%s\n" "$url" | sed 's|.*/||')
set -l name (
- spin "curl -Ss https://api.github.com/gists/$id" -f " @\r" | awk '
+ spin "curl -Ss https://api.github.com/gists/$gist_id" -f " $color@$color_normal\r" | awk '
- /"files": / { files++ }
+ /"files": / { files++ }
- /"[^ ]+.fish": / && files {
- gsub("^ *\"|\.fish.*", "")
- print
- }
+ /"[^ ]+.fish": / && files {
+ gsub("^ *\"|\.fish.*", "")
+ print
+ }
'
)
diff --git a/functions/__fisher_list.fish b/functions/__fisher_list.fish
new file mode 100644
index 0000000..3013fb6
--- /dev/null
+++ b/functions/__fisher_list.fish
@@ -0,0 +1,3 @@
+function __fisher_list
+ __fisher_file | __fisher_name
+end
diff --git a/functions/__fisher_path_update.fish b/functions/__fisher_path_update.fish
index 9521147..aa0de9d 100644
--- a/functions/__fisher_path_update.fish
+++ b/functions/__fisher_path_update.fish
@@ -1,27 +1,12 @@
function __fisher_path_update -a path
pushd $path
- set -l branch
-
- if not set branch (sed "s|.*/||" < .git/HEAD)
- return 1
- end
-
- git stash --quiet ^ /dev/null
- git checkout master --quiet ^ /dev/null
-
if not git pull --quiet --rebase origin master
- git rebase --abort > /dev/null
- git fetch --quiet origin master
- git reset --quiet --hard FETCH_HEAD
- git clean --quiet -d --force
+ git rebase --abort
+ git fetch --quiet origin master
+ git reset --quiet --hard FETCH_HEAD
+ git clean --quiet -d --force
end ^ /dev/null
- if test ! -z "$branch"
- git checkout "$branch" --quiet ^ /dev/null
- end
-
- git stash apply --quiet ^ /dev/null
-
popd
end
diff --git a/functions/fisher_install.fish b/functions/fisher_install.fish
index 91a78a0..aa86319 100644
--- a/functions/fisher_install.fish
+++ b/functions/fisher_install.fish
@@ -3,6 +3,8 @@ function fisher_install -d "Install plugins"
set -l option
set -l stdout /dev/stdout
set -l stderr /dev/stderr
+ set -l color (set_color $fish_color_match)
+ set -l color_normal (set_color normal)
getopts $argv | while read -l 1 2
switch "$1"
@@ -16,15 +18,20 @@ function fisher_install -d "Install plugins"
set plugins $plugins $2
end
+ case C no-color
+ set color
+ set color_normal
+
case q quiet
set stdout /dev/null
set stderr /dev/null
case h
printf "Usage: fisher install [] [--force] [--quiet] [--help]\n\n"
- printf " -f --force Reinstall given plugin/s\n"
- printf " -q --quiet Enable quiet mode\n"
- printf " -h --help Show usage help\n"
+ printf " -f --force Reinstall given plugin/s\n"
+ printf " -q --quiet Enable quiet mode\n"
+ printf " -C --no-color Turn off color display\n"
+ printf " -h --help Show usage help\n"
return
case \*
@@ -64,7 +71,7 @@ function fisher_install -d "Install plugins"
case https://gist.github.com\*
debug "Gist %s" $item
- if set -l name (__fisher_gist_to_name $item)
+ if set -l name (__fisher_gist_to_name $item )
printf "%s\t%s\n" $item $name
else
printf "fisher: Repository '%s' not found.\n" $item > $stderr
@@ -103,7 +110,7 @@ function fisher_install -d "Install plugins"
end
end | while read -l url name
- if contains -- $name (fisher_list $fisher_file)
+ if contains -- $name (fisher_list --enabled)
if test -z "$option"
set skipped $skipped $name
continue
@@ -133,7 +140,7 @@ function fisher_install -d "Install plugins"
else
debug "Clone %s" $url
- if not spin "__fisher_url_clone $url $path" --error=$stderr -f " @\r"
+ if not spin "__fisher_url_clone $url $path" --error=$stderr -f " $color@\r$color_normal"
continue
end
end
diff --git a/functions/fisher_list.fish b/functions/fisher_list.fish
index fe12a39..c3dba85 100644
--- a/functions/fisher_list.fish
+++ b/functions/fisher_list.fish
@@ -1,10 +1,12 @@
function fisher_list -a key -d "List installed plugins"
- switch "$key"
- case -b --bare
- __fisher_cache_list
+ set -l enabled
+ if test -s "$fisher_file"
+ set enabled (__fisher_list < $fisher_file)
+ end
+
+ switch "$key"
case ""
- set -l enabled (fisher_list $fisher_file)
set -l cache (__fisher_cache_list)
if test -z "$cache"
@@ -38,11 +40,9 @@ function fisher_list -a key -d "List installed plugins"
find $fisher_cache/* -maxdepth 0 -type l ^ /dev/null | sed 's|.*/||'
case --enabled
- fisher_list $fisher_file
+ printf "%s\n" $enabled
case --disabled
- set -l enabled (fisher_list $fisher_file)
-
for name in (__fisher_cache_list)
if not contains -- $name $enabled
printf "%s\n" $name
@@ -50,20 +50,14 @@ function fisher_list -a key -d "List installed plugins"
end
case -
- __fisher_file | __fisher_name
+ __fisher_list
case -h
- printf "Usage: fisher list [] [--enabled] [--disabled] [--bare] [--link] \n\n"
- printf " -b --bare List plugin without decorators\n"
+ printf "Usage: fisher list [--enabled] [--disabled] [--link]\n\n"
printf " -l --link List plugins that are symbolic links\n"
printf " --enabled List plugins that are enabled\n"
printf " --disabled List plugins that are disabled\n"
printf " -h --help Show usage help\n"
return
-
- case \*
- if test -s "$key"
- fisher_list - < $key
- end
end
end
diff --git a/functions/fisher_search.fish b/functions/fisher_search.fish
index 6da461f..df3b181 100644
--- a/functions/fisher_search.fish
+++ b/functions/fisher_search.fish
@@ -6,6 +6,8 @@ function fisher_search -d "Search plugin index"
set -l format
set -l option
set -l stdout /dev/stdout
+ set -l color (set_color $fish_color_match)
+ set -l color_normal (set_color normal)
getopts $argv | while read -l 1 2 3
switch "$1"
@@ -60,6 +62,8 @@ function fisher_search -d "Search plugin index"
set join "||"
case C no-color
+ set color
+ set color_normal
set option no-color
case query
@@ -101,7 +105,7 @@ function fisher_search -d "Search plugin index"
if test $fisher_last_update -gt $fisher_update_interval -o ! -f $index
debug "Update index start"
- if spin "__fisher_index_update" --error=/dev/null -f " @\r" > /dev/null
+ if spin "__fisher_index_update" --error=/dev/null -f " $color@$color_normal\r" > /dev/null
debug "Update index ok"
__fisher_complete_reset
else
diff --git a/functions/fisher_uninstall.fish b/functions/fisher_uninstall.fish
index 72e5df4..7ef0e50 100644
--- a/functions/fisher_uninstall.fish
+++ b/functions/fisher_uninstall.fish
@@ -68,7 +68,7 @@ function fisher_uninstall -d "Uninstall plugins"
debug "Uninstall %s" "$name"
- if not contains -- $name (fisher_list $fisher_file)
+ if not contains -- $name (fisher_list --enabled)
if test -z "$option"
set skipped $skipped $name
continue
diff --git a/functions/fisher_update.fish b/functions/fisher_update.fish
index 995271f..70dad2a 100644
--- a/functions/fisher_update.fish
+++ b/functions/fisher_update.fish
@@ -1,28 +1,22 @@
function fisher_update -d "Update plugins"
- set -l plugins
- set -l option self
+ set -l items
set -l stdout /dev/stdout
set -l stderr /dev/stderr
+ set -l indicator "▸"
+ set -l color (set_color $fish_color_match)
+ set -l color_normal (set_color normal)
getopts $argv | while read -l 1 2
switch "$1"
case _
- set option
-
- if test "$2" != -
- set plugins $plugins $2
- end
-
- case a all
- set option all
+ set items $items $2
case q quiet
set stdout /dev/null
set stderr /dev/null
case h
- printf "Usage: fisher update [] [--all] [--quiet] [--help]\n\n"
- printf " -a --all Update everything\n"
+ printf "Usage: fisher update [] [--quiet] [--help]\n\n"
printf " -q --quiet Enable quiet mode\n"
printf " -h --help Show usage help\n"
return
@@ -34,108 +28,110 @@ function fisher_update -d "Update plugins"
end
end
- set -l indicator "▸"
+ if set -l index (contains -i -- - $items)
+ set -e items[$index]
+ set -l IFS \t
- switch "$option"
- case all
- fisher_update (fisher_list --enabled)
- fisher_update
+ __fisher_file | while read -l item
+ set items $items $item
+ end
- case self
- set -l time (date +%s)
+ else if test -z "$items"
+ set -l time (date +%s)
- printf "$indicator Updating Fisherman\n" > $stderr
+ printf "$indicator Updating Fisherman\n" > $stderr
+ debug "Update %s" $fisher_cache/.index
+ debug "Update %s" $fisher_home
- debug "Update %s" $fisher_index
- debug "Update %s" $fisher_home
+ if not spin "__fisher_index_update 0" --error=$stderr -f " $color@$color_normal\r"
+ debug "Update Index fail"
+ end
- if not spin "__fisher_index_update 0" --error=$stderr -f " @\r"
- debug "Update Index fail"
- end
+ if not spin "__fisher_path_update $fisher_home" --error=$stderr -f " $color@$color_normal\r"
+ debug "Update Fisherman fail"
- if not spin "__fisher_path_update $fisher_home" --error=$stderr -f " @\r"
- debug "Update Fisherman fail"
+ printf "fisher: I couldn't update Fisherman.\n\n" > $stderr
+ return 1
+ end
+
+ debug "Update Fisherman ok"
- printf "fisher: Sorry, but I couldn't update Fisherman.\n\n" > $stderr
- return 1
- end
+ printf "Aye! Fisherman %s updated (%0.fs)\n" (
+ cat $fisher_home/VERSION) (math (date +%s) - $time) > $stderr
- debug "Update Fisherman ok"
-
- printf "Aye! Fisherman up to date with version %s (%0.fs)\n" (
- cat $fisher_home/VERSION) (math (date +%s) - $time) > $stderr
-
- case \*
- set -l time (date +%s)
- set -l count 0
- set -l index 1
- set -l total (count $plugins)
- set -l skipped
-
- set -l IFS \t
-
- if set -q plugins[1]
- printf "%s\n" $plugins
- else
- __fisher_file
-
- end | while read -l item path
-
- debug "Validate %s" $item
-
- if not set item (__fisher_plugin_validate $item)
- debug "Validate fail %s" $item
- printf "fisher: '%s' is not a valid name, path or URL.\n" $item > $stderr
- continue
- end
-
- debug "Validate ok %s" $item
-
- if not set path (__fisher_path_from_plugin $item)
- printf "fisher: '%s' not found.\n" $item > $stderr
- continue
- end
-
- set -l name (printf "%s\n" $path | __fisher_name)
-
- printf "$indicator Updating " > $stderr
-
- switch $total
- case 0 1
- printf "%s\n" $name > $stderr
-
- case \*
- printf "(%s of %s) %s\n" $index $total $name > $stderr
- set index (math $index + 1)
- end
-
- if test ! -L $path
- debug "Update start %s" "$name"
-
- if not spin "__fisher_path_update $path" --error=$stderr -f " @\r"
- debug "Update fail %s" "$path"
- continue
- end
- end
-
- debug "Update ok %s" "$name"
-
- if __fisher_plugin_can_enable "$name" "$path"
- debug "Enable %s" "$name"
-
- fisher_install --quiet --force -- $name
- end
-
- set count (math $count + 1)
- end
-
- set time (math (date +%s) - $time)
-
- if test $count -le 0
- printf "No plugins were updated.\n" > $stdout
- return 1
- end
-
- printf "%d plugin/s updated in %0.fs\n" $count $time > $stdout
+ set items (fisher_list --enabled)
end
+
+ for item in $items
+ debug "Validate %s" $item
+
+ if not set item (__fisher_plugin_validate $item)
+ debug "Validate fail %s" $item
+ printf "fisher: '%s' is not a valid name, path or URL.\n" $item > $stderr
+ continue
+ end
+
+ set -l path (__fisher_path_from_plugin $item)
+
+ if test -z "$path"
+ printf "fisher: Plugin '%s' is not installed.\n" $item > $stderr
+ continue
+ end
+
+ debug "Validate ok %s" $item
+
+ set plugins $plugins $path
+ end
+
+ set -l time (date +%s)
+ set -l total (count $plugins)
+ set -U fisher_updated_plugins
+
+ printf "Updating plugins...\n" $name > $stderr
+
+ for path in $plugins
+ set -l name (printf "%s\n" $path | __fisher_name)
+
+ if test ! -L $path
+ debug "Update start %s" "$name"
+ fish -ic "
+ spin '
+ if __fisher_path_update $path
+ set fisher_updated_plugins \$fisher_updated_plugins $name
+ printf \"%s\n\" \"$indicator $name\"
+ end
+
+ ' -f \" $color@$color_normal\r\"
+ " &
+ end
+ end
+
+ while jobs | grep . -q
+ end
+
+ for plugin in $fisher_updated_plugins
+ set -l path (__fisher_path_from_plugin)
+ if __fisher_plugin_can_enable "$plugin" "$path"
+ debug "Enable %s" "$plugin"
+ __fisher_plugin_enable "$plugin" "$path"
+ end
+ end
+
+ set time (math (date +%s) - $time)
+
+ if test -z "$fisher_updated_plugins"
+ printf "No plugins were updated.\n" > $stdout
+ set -e fisher_updated_plugins
+ return 1
+ end
+
+ printf "%d plugin/s updated in %0.fs\n" (count $fisher_updated_plugins) $time > $stdout
+ set -e fisher_updated_plugins
+
+ debug "Reset completions and key bindings start"
+
+ __fisher_complete_reset
+ __fisher_key_bindings_reset
+
+ debug "Reset completions and key bindings ok"
end
diff --git a/functions/spin.fish b/functions/spin.fish
index 997cccb..f2dff51 100644
--- a/functions/spin.fish
+++ b/functions/spin.fish
@@ -1,3 +1,3 @@
-function spin -d "Run fisher install spin to update this function." -a commands
+function spin -a commands
fish -c "$commands" ^ /dev/null
end
diff --git a/man/man1/fisher.1 b/man/man1/fisher.1
index 8616c89..01bfe0b 100644
--- a/man/man1/fisher.1
+++ b/man/man1/fisher.1
@@ -54,86 +54,117 @@ Show version information\. Fisherman follows Semantic Versioning and uses Git an
Show usage help\.
.
.SH "EXAMPLES"
+.
+.IP "\(bu" 4
Install plugins\.
.
+.IP "" 0
+.
.IP "" 4
.
.nf
-fisher install fishtape shark get
+fisher i fishtape shark get bobthefish
.
.fi
.
.IP "" 0
.
-.P
+.IP "\(bu" 4
+Install Oh My Fish! plugins\.
+.
+.IP "" 0
+.
+.IP "" 4
+.
+.nf
+
+fisher i omf/plugin\-{percol,jump,fasd}
+.
+.fi
+.
+.IP "" 0
+.
+.IP "\(bu" 4
Install a plugin from a local directory\.
.
-.IP "" 4
-.
-.nf
-
-fisher install \./path/to/plugin
-.
-.fi
-.
.IP "" 0
.
-.P
-Install a plugin from a URL\.
-.
.IP "" 4
.
.nf
-fisher install owner/repo
+fisher i \./path/to/plugin
.
.fi
.
.IP "" 0
.
-.P
-Install a plugin from a Gist URL\.
+.IP "\(bu" 4
+Install a plugin from various URLs\.
+.
+.IP "" 0
.
.IP "" 4
.
.nf
-fisher install gist\.github\.com/owner/1f40e1c6e0551b2666b2
+fisher i https://github\.com/some/plugin another/plugin bb:one/more
.
.fi
.
.IP "" 0
.
-.P
-Update Fisherman\.
+.IP "\(bu" 4
+Install a plugin from a Gist\.
+.
+.IP "" 0
.
.IP "" 4
.
.nf
-fisher update
+fisher i gist\.github\.com/owner/1f40e1c6e0551b2666b2
.
.fi
.
.IP "" 0
.
-.P
+.IP "\(bu" 4
+Update everything\.
+.
+.IP "" 0
+.
+.IP "" 4
+.
+.nf
+
+fisher u
+.
+.fi
+.
+.IP "" 0
+.
+.IP "\(bu" 4
Update plugins\.
.
+.IP "" 0
+.
.IP "" 4
.
.nf
-fisher update shark get
+fisher u shark get
.
.fi
.
.IP "" 0
.
-.P
+.IP "\(bu" 4
Uninstall plugins\.
.
+.IP "" 0
+.
.IP "" 4
.
.nf
@@ -144,27 +175,16 @@ fisher uninstall fishtape debug
.
.IP "" 0
.
-.P
-Uninstall plugins and remove them from the cache\.
-.
-.IP "" 4
-.
-.nf
-
-fisher uninstall fishtape debug \-f
-.
-.fi
+.IP "\(bu" 4
+Get help\.
.
.IP "" 0
.
-.P
-Show all the documentation\.
-.
.IP "" 4
.
.nf
-fisher help \-\-all
+fisher h
.
.fi
.
@@ -215,23 +235,26 @@ fisher search
.IP "" 0
.
.P
-Get detailed information about a plugin\.
+Query the index using regular expressions\.
.
.IP "" 4
.
.nf
-fisher search shellder
-> shellder by simnalamburt
-Powerline prompt optimized for speed
-github\.com/simnalamburt/shellder
+fisher search \-\-name~/git\-is/
+git\-is\-dirty Test if there are changes not staged for commit
+git\-is\-empty Test if a repository is empty
+git\-is\-repo Test if the current directory is a Git repo
+git\-is\-staged Test if there are changes staged for commit
+git\-is\-stashed Test if there are changes in the stash
+git\-is\-touched Test if there are changes in the working tree
.
.fi
.
.IP "" 0
.
.P
-Search plugins using tags\.
+Search using tags\.
.
.IP "" 4
.
@@ -239,11 +262,14 @@ Search plugins using tags\.
fisher search \-\-tag={git,test}
\.\.\.
-* fishtape TAP producing test runner
+ * fishtape TAP producing test runner
git\-branch\-name Get the name of the current Git branch
- git\-is\-repo Test if the current directory is a Git repo
git\-is\-dirty Test if there are changes not staged for commit
+ git\-is\-empty Test if a repository is empty
+ git\-is\-repo Test if the current directory is a Git repo
+ git\-is\-staged Test if there are changes staged for commit
git\-is\-stashed Test if there are changes in the stash
+ git\-is\-touched Test if there are changes in the working tree
\.\.\.
.
.fi
@@ -253,35 +279,35 @@ fisher search \-\-tag={git,test}
.P
The legend consists of:
.
-.P
-\fB*\fR The plugin is currently enabled
+.IP "\(bu" 4
+\fB*\fR The plugin is enabled
.
-.br
+.IP "\(bu" 4
\fB>\fR The plugin is a prompt
.
-.br
+.IP "\(bu" 4
\fB@\fR The plugin is a symbolic link
.
-.br
+.IP "" 0
.
.SH "PLUMBING"
Fisherman commands are pipe aware\. Plumb one with another to create complex functionality\.
.
.P
-Update all the plugins in the cache\.
+Update plugins installed as symbolic links\.
.
.IP "" 4
.
.nf
-fisher list | fisher update \-
+fisher list \-\-link | fisher update \-
.
.fi
.
.IP "" 0
.
.P
-Enable all the plugins that are currently disabled\.
+Enable all the plugins currently disabled\.
.
.IP "" 4
.
@@ -307,10 +333,12 @@ fisher list | fisher uninstall \-\-force
.IP "" 0
.
.SH "DOTFILES"
-When you install a plugin, Fisherman updates a file known as \fIfishfile\fR to track what plugins are currently enabled\.
+When you install a plugin, Fisherman updates the \fIfishfile\fR to track what plugins are currently enabled\.
.
-.P
-To customize its location:
+.IP "\(bu" 4
+Customize the location of the fishfile\.
+.
+.IP "" 0
.
.IP "" 4
.
@@ -355,10 +383,7 @@ $fisher_config
The index is a plain text database that lists Fisherman official plugins\.
.
.P
-The index is a list of records, each consisting of the following fields: \fIname\fR, \fIurl\fR, \fIinfo\fR, one or more \fItags\fR and \fIauthor\fR\.
-.
-.P
-Fields are separated by a new line \fB\en\fR\. Tags are separated by one \fIspace\fR\.
+The index lists records, each consisting the fields: \fIname\fR, \fIurl\fR, \fIinfo\fR, one or more \fItags\fR and \fIauthor\fR\.
.
.IP "" 4
.
@@ -375,65 +400,31 @@ jethrokuan
.IP "" 0
.
.P
-If you have a plugin to submit to the index, use the \fIsubmit\fR plugin\.
+If you have a plugin you would like to submit to the index, use the submit plugin\.
.
.IP "" 4
.
.nf
fisher install submit
-fisher submit my_plugin
+fisher submit my_plugin description tags url
.
.fi
.
.IP "" 0
.
.P
-Otherwise, submit the plugin manually by creating a pull request in the index repository \fIhttps://github\.com/fisherman/fisher\-index\fR\.
-.
-.IP "" 4
-.
-.nf
-
-git clone https://github\.com/fisherman/fisher\-index
-cd index
-echo "$name\en$url\en$info\en$tags\en$author\en\en" >> index
-git push origin master
-.
-.fi
-.
-.IP "" 0
-.
-.SH "FISHFILE"
-Fisherman keeps track of a special file known as \fIfishfile\fR to know what plugins are currently enabled\.
-.
-.IP "" 4
-.
-.nf
-
-# My Fishfile
-gitio
-fishtape
-shark
-get
-shellder
-.
-.fi
-.
-.IP "" 0
-.
-.P
-This file is automatically updated as you install and uninstall plugins\.
+Or, submit the plugin manually by creating a pull request in the index \fIhttps://github\.com/fisherman/fisher\-index\fR repository\.
.
.SH "VARIABLES"
.
.TP
-$fisher_home
-The home directory\. If you installed Fisherman using the recommended method \fBcurl \-sL install\.fisherman\.sh | fish\fR, the location ought to be \fIXDG_DATA_HOME/fisherman\fR\. If you clone Fisherman and run make yourself, the current working directory is used by default\.
+\fB$fisher_home\fR
+The home directory\. If you installed Fisherman using the recommended method, the location ought to be \fIXDG_DATA_HOME/fisherman\fR\.
.
.TP
$fisher_config
-The configuration directory\. This is default location of the \fIfishfile\fR, \fIkey_bindings\.fish\fR, \fIcache\fR, \fIfunctions\fR, \fIcompletions\fR and \fIconf\.d\fR directories\. The default location is \fIXDG_CONFIG_HOME/fisherman\fR\.
+The configuration directory\. This is default location of your \fIfishfile\fR, \fIkey_bindings\.fish\fR, \fIcache\fR, \fIfunctions\fR, \fIcompletions\fR and \fIconf\.d\fR directories\. \fIXDG_CONFIG_HOME/fisherman\fR by default\.
.
.TP
$fisher_file
@@ -468,10 +459,7 @@ See the documentation of new for details\.
Utilities are plugins that define one or more functions\.
.
.P
-This example walks you through creating \fIwtc\fR, a plugin based in \fIgithub/ngerakines/commitment\fR random commit message generator\.
-.
-.P
-Create a directory and initialize a Git repository\.
+Below is a plugin based in ngerakines/commitment \fIhttps://github/ngerakines/commitment\fR random commit message generator\.
.
.IP "" 4
.
@@ -479,19 +467,6 @@ Create a directory and initialize a Git repository\.
mkdir wtc
cd wtc
-git init
-git remote add origin https://github\.com//wtc
-.
-.fi
-.
-.IP "" 0
-.
-.P
-Add the wtc function\.
-.
-.IP "" 4
-.
-.nf
function wtc \-d "Generate a random commit message"
switch "$argv"
@@ -503,19 +478,17 @@ function wtc \-d "Generate a random commit message"
curl \-s whatthecommit\.com/index\.txt
end
functions wtc > wtc\.fish
+
+fisher install \.
.
.fi
.
.IP "" 0
.
-.P
-Install the plugin\.
-.
.IP "" 4
.
.nf
-fisher install \.
wtc
(\e /)
(O\.o)
@@ -526,21 +499,6 @@ wtc
.IP "" 0
.
.P
-Commit changes and push to your remote origin when you are done\.
-.
-.IP "" 4
-.
-.nf
-
-git add \-\-all
-git commit \-m "What the commit?"
-git push origin master
-.
-.fi
-.
-.IP "" 0
-.
-.P
To submit wtc to the official index\.
.
.IP "" 4
@@ -567,101 +525,24 @@ fisher install wtc
.IP "" 0
.
.P
-Create a completions directory and add a completions file\.
-.
-.IP "" 4
-.
-.nf
-
-mkdir completions
-$EDITOR completions/wtc\.fish
-.
-.fi
-.
-.IP "" 0
-.
-.IP "" 4
-.
-.nf
-
-complete \-\-command wtc \-\-short h \-\-long help \-\-description "Show usage help"
-.
-.fi
-.
-.IP "" 0
-.
-.P
-Or use \fB__fisher_complete\fR to create completions from wtc usage output\.
-.
-.IP "" 4
-.
-.nf
-
-wtc \-\-help | __fisher_complete wtc
-.
-.fi
-.
-.IP "" 0
-.
-.P
-Create a man/man1 directory and add a man(1) page for wtc\.
-.
-.P
-There are utilities that can help you generate man pages from various text formats\. For example, pandoc(1) and ronn(1)\.
-.
-.P
-To create a man page manually\.
-.
-.IP "" 4
-.
-.nf
-
-mkdir \-p man/man1
-$EDITOR man/man1/wtc\.1
-.
-.fi
-.
-.IP "" 0
-.
-.IP "" 4
-.
-.nf
-
- \.TH man 1 "Today" "1\.0" "wtc man page"
- \.SH NAME
- wtc \e\- Generate a random commit message
- \.SH SYNOPSIS
- wtc [\-\-help]
- \.SH OPTIONS
- \-h, \-\-help: Display help information\.
- \.SH SEE ALSO
- https://github\.com/ngerakines/commitment
-.
-.fi
-.
-.IP "" 0
-.
-.P
A plugin can list dependencies to other plugins using a \fIfishfile\fR\.
.
.P
-Create a new file in the root of your project and add the name or URL of your dependencies\.
+Create a \fIfishfile\fR in the root of your project and add the name or URL of your dependencies\.
.
.IP "" 4
.
.nf
-cat > fishfile
my_plugin
https://github\.com/owner/another_plugin
-^D
.
.fi
.
.IP "" 0
.
.SS "PROMPTS"
-Prompts, also known as themes, are plugins that modify the appearance of the shell prompt and modify fish syntax colors\.
+Prompts, or themes, are plugins that modify the appearance of the shell prompt and colors\.
.
.P
Create a \fBfish_prompt\fR function\.
@@ -703,8 +584,10 @@ Save the functions to a directory and install the prompt as a plugin\.
mkdir my_prompt
cd my_prompt
+
functions fish_prompt > fish_prompt\.fish
functions fish_right_prompt > fish_right_prompt\.fish
+
fisher install \.
.
.fi
@@ -719,30 +602,32 @@ Customize the colors fish uses for syntax highlighting\.
.nf
function set_color_custom
- set \-U fish_color_normal #\.\.\.
- set \-U fish_color_command #\.\.\.
- set \-U fish_color_param #\.\.\.
- set \-U fish_color_redirection #\.\.\.
- set \-U fish_color_comment #\.\.\.
- set \-U fish_color_error #\.\.\.
- set \-U fish_color_escape #\.\.\.
- set \-U fish_color_operator #\.\.\.
- set \-U fish_color_end #\.\.\.
- set \-U fish_color_quote #\.\.\.
- set \-U fish_color_autosuggestion #\.\.\.
- set \-U fish_color_valid_path #\.\.\.
- set \-U fish_color_cwd #\.\.\.
- set \-U fish_color_cwd_root #\.\.\.
- set \-U fish_color_match #\.\.\.
- set \-U fish_color_search_match #\.\.\.
- set \-U fish_color_selection #\.\.\.
- set \-U fish_pager_color_prefix #\.\.\.
- set \-U fish_pager_color_completion #\.\.\.
- set \-U fish_pager_color_description #\.\.\.
- set \-U fish_pager_color_progress #\.\.\.
- set \-U fish_color_history_current #\.\.\.
+ # set \-U fish_color_normal
+ # set \-U fish_color_command
+ # set \-U fish_color_param
+ # set \-U fish_color_redirection
+ # set \-U fish_color_comment
+ # set \-U fish_color_error
+ # set \-U fish_color_escape
+ # set \-U fish_color_operator
+ # set \-U fish_color_end
+ # set \-U fish_color_quote
+ # set \-U fish_color_autosuggestion
+ # set \-U fish_color_valid_path
+ # set \-U fish_color_cwd
+ # set \-U fish_color_cwd_root
+ # set \-U fish_color_match
+ # set \-U fish_color_search_match
+ # set \-U fish_color_selection
+ # set \-U fish_pager_color_prefix
+ # set \-U fish_pager_color_completion
+ # set \-U fish_pager_color_description
+ # set \-U fish_pager_color_progress
+ # set \-U fish_color_history_current
end
+
functions set_color_custom > set_color_custom\.fish
+
fisher update \.
.
.fi
@@ -794,40 +679,11 @@ fisher install fisher_time
.
.IP "" 0
.
-.P
-This creates a new directory fisher_time in the current working directory and installs the plugin\.
-.
-.P
-The following example implements a command to format plugin information into columns\.
-.
-.IP "" 4
-.
-.nf
-
-function fisher_info \-d "Display information about plugins"
- switch "$argv"
- case \-h \-\-help
- printf "Usage: fisher info [\.\.\.]\en\en"
- printf " \-h \-\-help Show usage help\en"
- return
- end
-
- for item in $argv
- fisher search $item \-\-name \-\-info
- end | sed \-E \'s/;/: /\' | column
-end
-
-fisher install fisher_info
-.
-.fi
-.
-.IP "" 0
-.
.SS "SNIPPETS"
Snippets are plugins that run code at the start of the shell\. Snippets must be placed inside a sub directory named conf\.d\.
.
.P
-The following example implements the fish_postexec hook to display the runtime of the last command in milliseconds\.
+The following example implements a fish_postexec hook to display the duration of the last command in milliseconds\.
.
.IP "" 4
.
@@ -835,11 +691,20 @@ The following example implements the fish_postexec hook to display the runtime o
mkdir \-p runtime/conf\.d
cd runtime
-cat > conf\.d/fish_postexec\.fish
+$EDITOR conf\.d/fish_postexec\.fish
+.
+.fi
+.
+.IP "" 0
+.
+.IP "" 4
+.
+.nf
+
function fish_postexec \-\-on\-event fish_postexec
printf "%sms\en" $CMD_DURATION > /dev/stderr
end
-^D
+
fisher install \./postexec
.
.fi
@@ -851,9 +716,3 @@ Fisherman was created by Jorge Bucaran :: @bucaran :: \fIj@bucaran\.me\fR\.
.
.P
See THANKS\.md file for a complete list of contributors\.
-.
-.SH "SEE ALSO"
-fisher help tutorial
-.
-.br
-
diff --git a/man/man1/fisher.md b/man/man1/fisher.md
index b76013c..afe5b4e 100644
--- a/man/man1/fisher.md
+++ b/man/man1/fisher.md
@@ -35,58 +35,58 @@ fisher help
## EXAMPLES
-Install plugins.
+* Install plugins.
+
+```
+fisher i fishtape shark get bobthefish
+```
+
+* Install Oh My Fish! plugins.
```fish
-fisher install fishtape shark get
+fisher i omf/plugin-{percol,jump,fasd}
```
-Install a plugin from a local directory.
+* Install a plugin from a local directory.
```fish
-fisher install ./path/to/plugin
+fisher i ./path/to/plugin
```
-Install a plugin from a URL.
+* Install a plugin from various URLs.
```fish
-fisher install owner/repo
+fisher i https://github.com/some/plugin another/plugin bb:one/more
```
-Install a plugin from a Gist URL.
+* Install a plugin from a Gist.
```fish
-fisher install gist.github.com/owner/1f40e1c6e0551b2666b2
+fisher i gist.github.com/owner/1f40e1c6e0551b2666b2
```
-Update Fisherman.
-
-```fish
-fisher update
-```
-
-Update plugins.
+* Update everything.
```
-fisher update shark get
+fisher u
```
-Uninstall plugins.
+* Update plugins.
+
+```
+fisher u shark get
+```
+
+* Uninstall plugins.
```
fisher uninstall fishtape debug
```
-Uninstall plugins and remove them from the cache.
-
-```
-fisher uninstall fishtape debug -f
-```
-
-Show all the documentation.
+* Get help.
```fish
-fisher help --all
+fisher h
```
## LIST AND SEARCH
@@ -120,45 +120,51 @@ fisher search
...
```
-Get detailed information about a plugin.
+Query the index using regular expressions.
```
-fisher search shellder
-> shellder by simnalamburt
-Powerline prompt optimized for speed
-github.com/simnalamburt/shellder
+fisher search --name~/git-is/
+git-is-dirty Test if there are changes not staged for commit
+git-is-empty Test if a repository is empty
+git-is-repo Test if the current directory is a Git repo
+git-is-staged Test if there are changes staged for commit
+git-is-stashed Test if there are changes in the stash
+git-is-touched Test if there are changes in the working tree
```
-Search plugins using tags.
+Search using tags.
```
fisher search --tag={git,test}
...
-* fishtape TAP producing test runner
+ * fishtape TAP producing test runner
git-branch-name Get the name of the current Git branch
- git-is-repo Test if the current directory is a Git repo
git-is-dirty Test if there are changes not staged for commit
+ git-is-empty Test if a repository is empty
+ git-is-repo Test if the current directory is a Git repo
+ git-is-staged Test if there are changes staged for commit
git-is-stashed Test if there are changes in the stash
+ git-is-touched Test if there are changes in the working tree
...
```
The legend consists of:
-`*` The plugin is currently enabled
-`>` The plugin is a prompt
-`@` The plugin is a symbolic link
+* `*` The plugin is enabled
+* `>` The plugin is a prompt
+* `@` The plugin is a symbolic link
## PLUMBING
Fisherman commands are pipe aware. Plumb one with another to create complex functionality.
-Update all the plugins in the cache.
+Update plugins installed as symbolic links.
```fish
-fisher list | fisher update -
+fisher list --link | fisher update -
```
-Enable all the plugins that are currently disabled.
+Enable all the plugins currently disabled.
```fish
fisher list --disabled | fisher install
@@ -172,9 +178,9 @@ fisher list | fisher uninstall --force
## DOTFILES
-When you install a plugin, Fisherman updates a file known as *fishfile* to track what plugins are currently enabled.
+When you install a plugin, Fisherman updates the *fishfile* to track what plugins are currently enabled.
-To customize its location:
+* Customize the location of the fishfile.
```fish
set -g fisher_file ~/.dotfiles/fishfile
@@ -207,9 +213,7 @@ $fisher_config
The index is a plain text database that lists Fisherman official plugins.
-The index is a list of records, each consisting of the following fields: *name*, *url*, *info*, one or more *tags* and *author*.
-
-Fields are separated by a new line `\n`. Tags are separated by one *space*.
+The index lists records, each consisting the fields: *name*, *url*, *info*, one or more *tags* and *author*.
```
z
@@ -219,44 +223,22 @@ z search cd jump
jethrokuan
```
-If you have a plugin to submit to the index, use the *submit* plugin.
+If you have a plugin you would like to submit to the index, use the submit plugin.
```
fisher install submit
-fisher submit my_plugin
+fisher submit my_plugin description tags url
```
-Otherwise, submit the plugin manually by creating a pull request in the index repository *https://github.com/fisherman/fisher-index*.
-
-```
-git clone https://github.com/fisherman/fisher-index
-cd index
-echo "$name\n$url\n$info\n$tags\n$author\n\n" >> index
-git push origin master
-```
-
-## FISHFILE
-
-Fisherman keeps track of a special file known as *fishfile* to know what plugins are currently enabled.
-
-```
-# My Fishfile
-gitio
-fishtape
-shark
-get
-shellder
-```
-
-This file is automatically updated as you install and uninstall plugins.
+Or, submit the plugin manually by creating a pull request in the [index](https://github.com/fisherman/fisher-index) repository.
## VARIABLES
* $fisher_home:
- The home directory. If you installed Fisherman using the recommended method `curl -sL install.fisherman.sh | fish`, the location ought to be *XDG_DATA_HOME/fisherman*. If you clone Fisherman and run make yourself, the current working directory is used by default.
+ The home directory. If you installed Fisherman using the recommended method, the location ought to be *XDG_DATA_HOME/fisherman*.
* $fisher_config:
- The configuration directory. This is default location of the *fishfile*, *key_bindings.fish*, *cache*, *functions*, *completions* and *conf.d* directories. The default location is *XDG_CONFIG_HOME/fisherman*.
+ The configuration directory. This is default location of your *fishfile*, *key_bindings.fish*, *cache*, *functions*, *completions* and *conf.d* directories. *XDG_CONFIG_HOME/fisherman* by default.
* $fisher_file:
See FISHFILE above.
@@ -283,20 +265,12 @@ See the documentation of new for details.
Utilities are plugins that define one or more functions.
-This example walks you through creating *wtc*, a plugin based in *github/ngerakines/commitment* random commit message generator.
-
-Create a directory and initialize a Git repository.
+Below is a plugin based in [ngerakines/commitment](https://github/ngerakines/commitment) random commit message generator.
```fish
mkdir wtc
cd wtc
-git init
-git remote add origin https://github.com//wtc
-```
-Add the wtc function.
-
-```fish
function wtc -d "Generate a random commit message"
switch "$argv"
case -h --help
@@ -307,26 +281,16 @@ function wtc -d "Generate a random commit message"
curl -s whatthecommit.com/index.txt
end
functions wtc > wtc.fish
-```
-Install the plugin.
-
-```fish
fisher install .
+```
+```
wtc
(\ /)
(O.o)
(> <) Bunny approves these changes.
```
-Commit changes and push to your remote origin when you are done.
-
-```fish
-git add --all
-git commit -m "What the commit?"
-git push origin master
-```
-
#### SUBMIT
To submit wtc to the official index.
@@ -341,66 +305,20 @@ This will create a PR in the Fisherman index repository. Once the PR is approved
fisher install wtc
```
-#### COMPLETIONS
-
-Create a completions directory and add a completions file.
-
-```fish
-mkdir completions
-$EDITOR completions/wtc.fish
-```
-
-```fish
-complete --command wtc --short h --long help --description "Show usage help"
-```
-
-Or use `__fisher_complete` to create completions from wtc usage output.
-
-```
-wtc --help | __fisher_complete wtc
-```
-
-#### DOCS
-
-Create a man/man1 directory and add a man(1) page for wtc.
-
-There are utilities that can help you generate man pages from various text formats. For example, pandoc(1) and ronn(1).
-
-To create a man page manually.
-
-```
-mkdir -p man/man1
-$EDITOR man/man1/wtc.1
-```
-
-```
- .TH man 1 "Today" "1.0" "wtc man page"
- .SH NAME
- wtc \- Generate a random commit message
- .SH SYNOPSIS
- wtc [--help]
- .SH OPTIONS
- -h, --help: Display help information.
- .SH SEE ALSO
- https://github.com/ngerakines/commitment
-```
-
#### DEPENDENCIES
A plugin can list dependencies to other plugins using a *fishfile*.
-Create a new file in the root of your project and add the name or URL of your dependencies.
+Create a *fishfile* in the root of your project and add the name or URL of your dependencies.
-```fish
-cat > fishfile
+```
my_plugin
https://github.com/owner/another_plugin
-^D
```
### PROMPTS
-Prompts, also known as themes, are plugins that modify the appearance of the shell prompt and modify fish syntax colors.
+Prompts, or themes, are plugins that modify the appearance of the shell prompt and colors.
Create a `fish_prompt` function.
@@ -408,9 +326,10 @@ Create a `fish_prompt` function.
function fish_prompt
printf "%s (%s) >> " (prompt_pwd) Fisherman
end
+```
+```
~ (Fisherman) >> type here
```
-
To add a right prompt, create a `fish_right_prompt` function.
```fish
@@ -424,8 +343,10 @@ Save the functions to a directory and install the prompt as a plugin.
```fish
mkdir my_prompt
cd my_prompt
+
functions fish_prompt > fish_prompt.fish
functions fish_right_prompt > fish_right_prompt.fish
+
fisher install .
```
@@ -433,30 +354,32 @@ Customize the colors fish uses for syntax highlighting.
```fish
function set_color_custom
- set -U fish_color_normal #...
- set -U fish_color_command #...
- set -U fish_color_param #...
- set -U fish_color_redirection #...
- set -U fish_color_comment #...
- set -U fish_color_error #...
- set -U fish_color_escape #...
- set -U fish_color_operator #...
- set -U fish_color_end #...
- set -U fish_color_quote #...
- set -U fish_color_autosuggestion #...
- set -U fish_color_valid_path #...
- set -U fish_color_cwd #...
- set -U fish_color_cwd_root #...
- set -U fish_color_match #...
- set -U fish_color_search_match #...
- set -U fish_color_selection #...
- set -U fish_pager_color_prefix #...
- set -U fish_pager_color_completion #...
- set -U fish_pager_color_description #...
- set -U fish_pager_color_progress #...
- set -U fish_color_history_current #...
+ # set -U fish_color_normal
+ # set -U fish_color_command
+ # set -U fish_color_param
+ # set -U fish_color_redirection
+ # set -U fish_color_comment
+ # set -U fish_color_error
+ # set -U fish_color_escape
+ # set -U fish_color_operator
+ # set -U fish_color_end
+ # set -U fish_color_quote
+ # set -U fish_color_autosuggestion
+ # set -U fish_color_valid_path
+ # set -U fish_color_cwd
+ # set -U fish_color_cwd_root
+ # set -U fish_color_match
+ # set -U fish_color_search_match
+ # set -U fish_color_selection
+ # set -U fish_pager_color_prefix
+ # set -U fish_pager_color_completion
+ # set -U fish_pager_color_description
+ # set -U fish_pager_color_progress
+ # set -U fish_color_history_current
end
+
functions set_color_custom > set_color_custom.fish
+
fisher update .
```
@@ -481,46 +404,27 @@ It's 6:30
Make it a plugin
-
```fish
fisher install fisher_time
```
-This creates a new directory fisher_time in the current working directory and installs the plugin.
-
-The following example implements a command to format plugin information into columns.
-
-```fish
-function fisher_info -d "Display information about plugins"
- switch "$argv"
- case -h --help
- printf "Usage: fisher info [...]\n\n"
- printf " -h --help Show usage help\n"
- return
- end
-
- for item in $argv
- fisher search $item --name --info
- end | sed -E 's/;/: /' | column
-end
-
-fisher install fisher_info
-```
-
### SNIPPETS
Snippets are plugins that run code at the start of the shell. Snippets must be placed inside a sub directory named conf.d.
-The following example implements the fish_postexec hook to display the runtime of the last command in milliseconds.
+The following example implements a fish_postexec hook to display the duration of the last command in milliseconds.
```fish
mkdir -p runtime/conf.d
cd runtime
-cat > conf.d/fish_postexec.fish
+$EDITOR conf.d/fish_postexec.fish
+```
+
+```fish
function fish_postexec --on-event fish_postexec
printf "%sms\n" $CMD_DURATION > /dev/stderr
end
-^D
+
fisher install ./postexec
```
@@ -529,7 +433,3 @@ fisher install ./postexec
Fisherman was created by Jorge Bucaran :: @bucaran :: *j@bucaran.me*.
See THANKS.md file for a complete list of contributors.
-
-## SEE ALSO
-
-fisher help tutorial
diff --git a/test/fixtures/help/usage.txt b/test/fixtures/help/usage.txt
deleted file mode 100644
index a60e084..0000000
--- a/test/fixtures/help/usage.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Usage: fisher update [] [--all] [--quiet] [--help]
-
- -a --all Update everything
- -q --quiet Enable quiet mode
- -h --help Show usage help
-Usage: fisher uninstall [] [--force] [--quiet] [--help]
-
- -f --force Delete copy from the cache
- -q --quiet Enable quiet mode
- -h --help Show usage help
-Usage: fisher search [] [--long] [--full] [--no-color]
- [--quiet] [--help]
-
- --long Display results in long format
- --full Display results in full format
- -C --no-color Turn off color display
- -q --quiet Enable quiet mode
- -h --help Show usage help
-Usage: fisher list [] [--enabled] [--disabled] [--bare] [--link]
-
- -b --bare List plugin without decorators
- -l --link List plugins that are symbolic links
- --enabled List plugins that are enabled
- --disabled List plugins that are disabled
- -h --help Show usage help
-Usage: fisher install [] [--force] [--quiet] [--help]
-
- -f --force Reinstall given plugin/s
- -q --quiet Enable quiet mode
- -h --help Show usage help
-Usage: fisher help []
diff --git a/test/help.fish b/test/help.fish
index b5ee3f1..4f4ee43 100644
--- a/test/help.fish
+++ b/test/help.fish
@@ -26,9 +26,3 @@ for i in $sections
(fisher help foo | xargs) = foo
end
end
-
-test "$TESTNAME - Display usage help for every command"
- (cat $DIRNAME/fixtures/help/usage.txt) = (
- __fisher_help_commands | cut -f1 -d \; | fisher help --usage
- )
-end
diff --git a/test/install.fish b/test/install.fish
index 7322a92..766c845 100644
--- a/test/install.fish
+++ b/test/install.fish
@@ -5,9 +5,9 @@ function -S setup
source $DIRNAME/helpers/config-mock.fish $path/config
- fisher install foo bar --quiet
- fisher install https://github.com/foobar --quiet
- fisher install $DIRNAME/fixtures/plugins/baz --quiet
+ fisher install foo bar --quiet --no-color
+ fisher install https://github.com/foobar --quiet --no-color
+ fisher install $DIRNAME/fixtures/plugins/baz --quiet --no-color
end
function -S teardown
diff --git a/test/list-fishfile.fish b/test/list-fishfile.fish
index b7c0958..f9bcfed 100644
--- a/test/list-fishfile.fish
+++ b/test/list-fishfile.fish
@@ -4,6 +4,6 @@ set -l plugins foo bar baz quux hoge foobar fred thud chomp gisty mof
test "$TESTNAME - Parse fishfile and retrieve plugin names with fisher list fishfile"
$plugins = (
- fisher list $manifest/fishfile
+ fisher list - < $manifest/fishfile
)
end
diff --git a/test/list.fish b/test/list.fish
index bf0deec..cea4762 100644
--- a/test/list.fish
+++ b/test/list.fish
@@ -35,7 +35,7 @@ test "$TESTNAME - Append * to active plugins"
end
test "$TESTNAME - Add one space indentation to disabled plugins to align with > and *"
- (fisher list | sed '/^[\*>].*/d') = " norf"
+ (fisher list | sed '/^[\*>].*/d') = " norf"
end
test "$TESTNAME - Do not add indentation when no plugins are enabled"
@@ -46,25 +46,6 @@ test "$TESTNAME - Do not add indentation when no plugins are enabled"
)
end
-test "$TESTNAME - Wrap fisher list=bare with __fisher_cache_list"
- (fisher list --bare) = (__fisher_cache_list)
-end
-
-# test "$TESTNAME - Get URL from path (__fisher_url_from_path) with fisher list=url"
-# (fisher list --url) = (
-# for plugin in foo bar baz theme norf
-# switch "$plugin"
-# case theme
-# echo $path/theme
-# case norf
-# echo $plugin@https://gist.github.com/$plugin
-# case \*
-# echo https://github.com/$plugin/$plugin
-# end
-# end
-# )
-# end
-
test "$TESTNAME - Show active / enabled plugins/prompts with fisher list=enabled"
foo bar baz theme = (fisher list --enabled)
end
@@ -73,14 +54,6 @@ test "$TESTNAME - Show disabled/inactive plugins/prompts with fisher list=disabl
(fisher list --disabled) = norf
end
-# test "$TESTNAME - Shadow fisher list=theme to fisher list=prompt"
-# (fisher list=theme) = (fisher list=prompt)
-# end
-#
-# test "$TESTNAME - Return the contents of \$fisher_prompt fisher list=theme|prompt"
-# (fisher list=prompt) = theme
-# end
-
test "$TESTNAME - Parse a fishfile and display plugins with fisher list="
- foo bar baz theme = (fisher list $fisher_file)
+ foo bar baz theme = (fisher list - < $fisher_file)
end
diff --git a/test/path-update.fish b/test/path-update.fish
deleted file mode 100644
index 35ba454..0000000
--- a/test/path-update.fish
+++ /dev/null
@@ -1,3 +0,0 @@
-test "$TESTNAME - Update Git repo at path"
- -z ""
-end
diff --git a/test/uninstall.fish b/test/uninstall.fish
index f41c2de..88f65c2 100644
--- a/test/uninstall.fish
+++ b/test/uninstall.fish
@@ -5,7 +5,7 @@ function -S setup
source $DIRNAME/helpers/config-mock.fish $path/config
- fisher install foo bar foobar --quiet
+ fisher install foo bar foobar --quiet --no-color
fisher uninstall foo --quiet
fisher uninstall foobar --quiet --force
end
diff --git a/test/update.fish b/test/update.fish
deleted file mode 100644
index 8a12b49..0000000
--- a/test/update.fish
+++ /dev/null
@@ -1,29 +0,0 @@
-set -l path $DIRNAME/.t-$TESTNAME-(random)
-
-function -S setup
- mkdir -p $path/config/cache
-
- source $DIRNAME/helpers/config-mock.fish $path/config
-
- function __fisher_path_update
- echo "$argv[1]"
- end
-
- fisher install foo --quiet
- fisher update foo > $path/foo --quiet
-
- fisher update --quiet > $path/self
-end
-
-function -S teardown
- rm -rf $path
- source $DIRNAME/helpers/config-mock-teardown.fish
-end
-
-test "$TESTNAME - Update plugin path"
- (cat $path/foo) = "$path/config/cache/foo"
-end
-
-test "$TESTNAME - Update Index and \$fisher_home"
- (cat $path/self) = $fisher_home
-end