mirror of
https://github.com/jorgebucaran/fisher
synced 2024-11-09 07:10:27 +00:00
4cfd037cc0
+ Add the ability to install plugins from Gists. You can distribute a very simple, one-single function plugin in the form of a Gist. Your users can install it using fisher install url and Fisherman will query the Gist using the GitHub API to get a list of the Gist files and use the name of the first identified *.fish file to name the plugin in your system. Since there is no formal way to name a Gist, and you may prefer to keep the "description" field for the actual description and not a name, Fisherman supports only one fish file per Gist. Closes #75. + Use command(1) when calling non-builtins. Thanks @daenney. Closes #79. + Add __fisher_plugin_can_enable to detect installing a prompt that is not the current one. Closes #78. + Remove the ability to install a plugin in a parent directory using .. or ../ or even worse, ../../ as well as other combinations that navigate to a parent directory. I find the use case odd at best, and more dangerous that useful. If you want to install a local plugin use the full path or a relative path, always top down. fisher install . or fisher install my/plugin or fisher install /Users/$USER/path/to/plugin. Closes #81.
99 lines
2.8 KiB
Fish
99 lines
2.8 KiB
Fish
set -l path $DIRNAME/.t-$TESTNAME-(random)
|
|
set -l fisherman_url https://github.com/fisherman/fisherman
|
|
|
|
function -S setup
|
|
mkdir -p $path/cache/{foo,bar,baz,norf} $path/theme
|
|
|
|
ln -s $path/theme $path/cache/theme
|
|
|
|
printf "%s\n" foo bar baz theme > $path/fishfile
|
|
|
|
set -g fisher_cache $path/cache
|
|
|
|
# Fisherman uses the Fishfile to keep track of what plugins are currently installed
|
|
# so we need to create one in order to test all of fisher --list=<styles>.
|
|
|
|
# See also `list-fishfile.fish`.
|
|
|
|
set -g fisher_file $path/fishfile
|
|
set -U fisher_prompt theme
|
|
|
|
source $DIRNAME/helpers/git-ls-remote.fish
|
|
end
|
|
|
|
function -S teardown
|
|
rm -rf $path
|
|
functions -e git
|
|
end
|
|
|
|
test "$TESTNAME - Wrap fisher -l with __fisher_list"
|
|
(__fisher_list) = (fisher -l)
|
|
end
|
|
|
|
test "$TESTNAME - Wrap fisher --list=cache with fisher --list"
|
|
(fisher --list) = (fisher --list=cache)
|
|
end
|
|
|
|
test "$TESTNAME - Wrap fisher --list with --list=all "
|
|
(fisher --list) = (fisher --list=all)
|
|
end
|
|
|
|
test "$TESTNAME - Append > to active theme"
|
|
(fisher --list | sed -n '/>.*/p') = ">theme"
|
|
end
|
|
|
|
test "$TESTNAME - Append * to active plugins"
|
|
(fisher --list | sed -n '/\*.*/p' | xargs) = "*bar *baz *foo"
|
|
end
|
|
|
|
test "$TESTNAME - Add one space indentation to disabled plugins to align with > and *"
|
|
(fisher --list | sed '/^[\*>].*/d') = " norf"
|
|
end
|
|
|
|
test "$TESTNAME - Do not add indentation when no plugins are enabled"
|
|
(rm $path/fishfile; fisher --list) = (
|
|
for plugin in foo bar baz norf theme
|
|
echo $plugin
|
|
end
|
|
)
|
|
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
|
|
|
|
test "$TESTNAME - Show disabled/inactive plugins/prompts with fisher --list=disabled"
|
|
(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=<file>"
|
|
foo bar baz theme = (fisher --list=$fisher_file)
|
|
end
|