From 9c22f43f518f0a5827a625717794ccf0cbc89185 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Thu, 4 Feb 2016 13:56:06 +0900 Subject: [PATCH] Strip plugin list decorators when parsing fishfile --- functions/__fisher_file.fish | 2 +- test/file.fish | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/__fisher_file.fish b/functions/__fisher_file.fish index 28d80ce..d07627c 100644 --- a/functions/__fisher_file.fish +++ b/functions/__fisher_file.fish @@ -9,7 +9,7 @@ function __fisher_file } !/^[ \t]*(#.*)*$/ { - gsub("#.*", "") + gsub("^[|*>]|#.*", "") if (! seen[$1]++) { printf("%s\n", $1) diff --git a/test/file.fish b/test/file.fish index 4c7d956..bccffc7 100644 --- a/test/file.fish +++ b/test/file.fish @@ -4,8 +4,6 @@ set -l manifest $DIRNAME/fixtures/manifest # __fisher_file parses a fishfile/bundle and writes declared plugins to standard out. # URLs and paths are returned *as is*. To retrieve the plugin names use fisher --list -# See also `list-fishfile.fish`. - test "$TESTNAME - Parse a fishfile/bundle #1" (__fisher_file < $manifest/fishfile) = (cat $manifest/fishfile-parsed) end @@ -13,3 +11,11 @@ end test "$TESTNAME - Parse a fishfile/bundle #2" (__fisher_file < $manifest/fishfile-parsed) = (cat $manifest/fishfile-parsed) end + +test "$TESTNAME - Remove `*` and `>` decorators from the input" + + # These characters indicate a plugin is enabled or a plugin is the + # currently selected prompt. + + (printf "%s\n" "*plugin" ">theme" | __fisher_file) = plugin theme +end