After a quick look through fundle.fish, I noticed that __fundle_init's return value isn't used anywhere.
In a way, it makes sens because it is not a function that fundle itself relies on the output of to determine anything.
For a user, though, this makes scripting the installation of plugins slightly more tedious.
This PR changes that.
It's a very simple change, but still a great quality of life improvement IMO.
As for a concrete, real-life example, my plugin initialisation file contains this:
(Skip to the last if statement if you only want to see the change brought by this PR)
# Automatically install fundle
if not functions -q fundle;
eval (curl -sfL https://git.io/fundle-install);
end
# Easily access your plugin folder
set -Ux fish_plugin_dir (realpath $__fish_config_dir/fundle)
# And plugin list
set -Ux fish_plugins (realpath $__fish_config_dir/fish_plugins)
# Create the directory if necessary
if ! test -d $fish_plugin_dir
mkdir -p $fish_plugin_dir
end
# Read the plugin list and store it
set -l __plugins (
string split0 -- (
# Filter out commented lines
string match -r '^\s*[^#].+$' -- (cat $fish_plugins)
)
)
# Enable found plugins
for p in $__plugins
fundle plugin $p
end
# Try initialising plugins.
# If any are missing, fundle will output a message, and stay silent otherwise.
# This is what we test to determine if we need to run the install command.
if string match -qr 'not installed' -- (string collect -- (fundle init))
set_color brgreen
echo "Populating your plugin directory ($fish_plugin_dir)..."
set_color normal
fundle install | string match -er 'Installing'
set_color brgreen
echo "Done !"
set_color normal
exec fish
end
Note how the last if's test is clearly suboptimal, whereas when __fundle_init returns 1 on uninstalled plugins, you could change it to
# Try initialising plugins.
# If any are missing, install them and reload the shell.
if not fundle init >/dev/null
# ...
end
After a quick look through
fundle.fish
, I noticed that__fundle_init
's return value isn't used anywhere. In a way, it makes sens because it is not a function that fundle itself relies on the output of to determine anything. For a user, though, this makes scripting the installation of plugins slightly more tedious.This PR changes that. It's a very simple change, but still a great quality of life improvement IMO.
As for a concrete, real-life example, my plugin initialisation file contains this: (Skip to the last
if
statement if you only want to see the change brought by this PR)Note how the last
if
's test is clearly suboptimal, whereas when__fundle_init
returns1
on uninstalled plugins, you could change it to