Skip to content

Commit 546cdcc

Browse files
committed
Initialize _fisher_plugins using fish_plugins file (#741)
This change is for users who commit fish_plugins and plugin sources but omit fish_variables. On a system where Fisher's universal variables are unset, most Fisher commands were not working out-of-the-box: * `fisher install <plugin>` - installs <plugin>, rewrites fish_plugins file with only <plugin> - if <plugin> is in fish_plugins, same behavior as `fisher update` * `fisher remove <plugin>` - fails with error: Plugin not installed "<plugin>" * `fisher update <plugin>` - fails with error: Plugin not installed "<plugin>" * `fisher update` - fails with error about conflicting files, deletes fish_plugins file * `fisher list [<regex>]` - returns nothing As of this commit all Fisher commands work except for `fisher remove`; Fisher still has no way of knowing which files to remove absent the universal variable that tracks the files associated to a plugin. It may make sense to reject calls like `fisher remove <plugin>` if the `_fisher_<plugin>_files` universal variable is missing. Fisher could suggest the user run `fisher update` and try again.
1 parent 36810b3 commit 546cdcc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: functions/fisher.fish

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
22
set --query fisher_path || set --local fisher_path $__fish_config_dir
33
set --local fisher_version 4.4.3
44
set --local fish_plugins $__fish_config_dir/fish_plugins
5+
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
6+
set --query _fisher_plugins || set --universal _fisher_plugins $file_plugins
57

68
switch "$cmd"
79
case -v --version
@@ -29,8 +31,6 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
2931
set --local old_plugins $_fisher_plugins
3032
set --local new_plugins
3133

32-
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
33-
3434
if ! set --query argv[2]
3535
if test "$cmd" != update
3636
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1

0 commit comments

Comments
 (0)