fisher/test/list.fish
Jorge Bucaran 2cbbb00dcb Fisherman 1.0 RC
* 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.

* Large documentation rewrite. Better, simpler, more concise
  and more consistent.

* Fisherman now detects if users have modified their fish
  prompt using fish_config and if so, uninstalls $fisher_prompt.
2016-02-29 23:13:29 +09:00

87 lines
2.5 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 - 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