fisher/functions/__fisher_plugin_enable.fish
Jorge Bucaran 8384bf3aa7
Ahoy!! Fisherman 1.0.0
* Deprecate fisher --list in favor of a new command
  fisher list. The behavior is roughly the same. See
  fisher help list for usage. tl;dr: Use list to query
  the local system / cache and search to query the index.

* Teach fisher_plugin_walk about fish_postexec,
  fish_command_not_found and fish_preexec event emitters
  and erase them during uninstall if they were defined in
  a snippet.

* Fisherman now recognizes the following aliases by default:
  i for install, u for update, l for list, s for search and
  h for help.

* Rewrite documentation to be simpler and more consistent.

* Fisherman can install "functions" now. If you have created
  a function interactively, you can run fisher install name
  of the function and a directory will be created in
  $PWD/name of the function and installed as usual.

* Fisherman now detects if users have modified their fish
  prompt using fish_config and if so, uninstalls $fisher_prompt.

* Search results now truncate plugin descriptions based in
 the width of the terminal screen.

* Install/Update/Uninstall CLI was retouched.

Looking behind and Ahead
========================

On Jan, 1st, Fisherman 0.1.0 departed from the bay of
"my hard drive" and today 1.0.0 has finally shipped.

Things are still a little rough and knotty, what did
you think? But 1.0.0 means all the basic things are
here.

Internally, we may still push some large changes, more
robust tests; at ~300 there are still areas a bit dry.

On the outside, Fisherman will change little, I hope.
That's a feature. If you want a more colorful CLI,
concurrent updates, or another bit here and there,
we may work something out.

This release means more time to focus on the plugin
ecosystem, but the adventures are far from over.
2016-03-01 18:02:38 +09:00

58 lines
1.5 KiB
Fish

function __fisher_plugin_enable -a plugin path
debug "Enable %s" "$plugin"
if __fisher_path_is_prompt $path
if test ! -z "$fisher_prompt"
debug "Enable prompt %s" $plugin
__fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt"
end
set -U fisher_prompt $plugin
end
set -l link -f
if test -L $path
set link -sfF
end
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target __unused
switch "$class"
case --bind
debug "Bind %s" $source
__fisher_key_bindings_enable $plugin (__fisher_xdg --config
)/fish/functions/fish_user_key_bindings.fish < $source
case --uninstall
case \*
if test "$class" = --man
command mkdir -p (dirname $fisher_config/$target)
end
__fisher_plugin_link $link $source $fisher_config/$target
if test "$class" = --source
__fisher_plugin_source $plugin $fisher_config/$target
end
end
end
set -l item (
if not fisher_search --name=$plugin --name --index=$fisher_cache/.index
__fisher_url_from_path $path
end
)
if test -s $fisher_file
if __fisher_file_contains "$item" --quiet $fisher_file
debug "File skip %s" "$item"
return
end
end
debug "File add %s" "$item"
printf "%s\n" $item >> $fisher_file
end