Improve __fisher_name name resolution algorithm.

Improve __fisher_name name resolution from paths or URLs
more accurately. Now correctly process names paths such
as fisher-plugin-*, fisher-theme-* and other permutations.
This commit is contained in:
Jorge Bucaran 2016-02-25 13:48:48 +09:00
parent 7929b61caa
commit b9a158d4fc
4 changed files with 68 additions and 9 deletions

View File

@ -6,6 +6,8 @@
* Update plugins with a dirty working tree by recording changes in the stash and re-reapplying them again after the git-pull update strategy completes.
* Improve `__fisher_name` name resolution from paths or URLs more accurately. Now correctly process names paths such as `fisher-plugin-*`, `fisher-theme-*` and other permutations.
* Make `__fisher_key_bindings_undo` smarter by supporting more complex `bind` expressions, such as those inside conditional statements. Close #121.
* The Quickstart Guide is now available in [Chinese](https://github.com/fisherman/fisherman/wiki/快速上手指南), [Russian](https://github.com/fisherman/fisherman/wiki/Краткое-Руководство) and [Korean](https://github.com/fisherman/fisherman/wiki/빠르게-살펴보기). Thanks to @pickfire, @denji, @dfdgsdfg. You folks are awesome!

View File

@ -1,3 +1,6 @@
function __fisher_name
sed -E 's|.*/(.*)|\1|; s/^(plugin|omf-theme|theme|pkg|omf|fish|fisher)-//'
sed -E '
s|.*/(.*)|\1|
s/(plugin|omf-theme|theme|pkg|omf|fish|fisher|fisherman)-//g
'
end

View File

@ -38,7 +38,6 @@ function fisher_uninstall -d "Uninstall Plugins"
set -l skipped
if set -q plugins[1]
printf "%s\n" $plugins
else
__fisher_file

View File

@ -1,31 +1,86 @@
test "$TESTNAME - Remove plugin- prefix"
test "$TESTNAME - Remove plugin-* prefix"
bar = (echo https://github.com/foo/plugin-bar | __fisher_name)
end
test "$TESTNAME - Remove plugin-theme-* prefix"
bar = (echo https://github.com/foo/plugin-theme-bar | __fisher_name)
end
test "$TESTNAME - Remove omf-theme- prefix"
test "$TESTNAME - Remove omf-theme-* prefix"
bar = (echo https://github.com/foo/omf-theme-bar | __fisher_name)
end
test "$TESTNAME - Remove theme- prefix"
test "$TESTNAME - Remove theme-omf-* prefix"
bar = (echo https://github.com/foo/theme-omf-bar | __fisher_name)
end
test "$TESTNAME - Remove theme-* prefix"
bar = (echo https://github.com/foo/theme-bar | __fisher_name)
end
test "$TESTNAME - Remove pkg- prefix"
test "$TESTNAME - Remove pkg-* prefix"
bar = (echo https://github.com/foo/pkg-bar | __fisher_name)
end
test "$TESTNAME - Remove omf- prefix"
test "$TESTNAME - Remove pkg-pkg-* prefix"
bar = (echo https://github.com/foo/pkg-pkg-bar | __fisher_name)
end
test "$TESTNAME - Remove omf-* prefix"
bar = (echo https://github.com/foo/omf-bar | __fisher_name)
end
test "$TESTNAME - Remove fish- prefix"
test "$TESTNAME - Remove fish-* prefix"
bar = (echo https://github.com/foo/fish-bar | __fisher_name)
end
test "$TESTNAME - Remove fisher- prefix"
test "$TESTNAME - Remove fish-fish-* prefix"
bar = (echo https://github.com/foo/fish-fish-bar | __fisher_name)
end
test "$TESTNAME - Remove fisher-* prefix"
bar = (echo https://github.com/foo/fisher-bar | __fisher_name)
end
test "$TESTNAME - Remove fisher-fisher-* prefix"
bar = (echo https://github.com/foo/fisher-fisher-bar | __fisher_name)
end
test "$TESTNAME - Remove fisher-theme-* prefix"
bar = (echo https://github.com/foo/fisher-theme-bar | __fisher_name)
end
test "$TESTNAME - Remove theme-fisher-* prefix"
bar = (echo https://github.com/foo/theme-fisher-bar | __fisher_name)
end
test "$TESTNAME - Remove fish-theme-* prefix"
bar = (echo https://github.com/foo/fish-theme-bar | __fisher_name)
end
test "$TESTNAME - Remove theme-fish-* prefix"
bar = (echo https://github.com/foo/theme-fish-bar | __fisher_name)
end
test "$TESTNAME - Remove fish-pkg-* prefix"
bar = (echo https://github.com/foo/fish-pkg-bar | __fisher_name)
end
test "$TESTNAME - Remove pkg-fish-* prefix"
bar = (echo https://github.com/foo/pkg-fish-bar | __fisher_name)
end
test "$TESTNAME - Remove fisherman-* prefix"
bar = (echo https://github.com/foo/fisherman-bar | __fisher_name)
end
test "$TESTNAME - Remove fisherman-theme-* prefix"
bar = (echo https://github.com/foo/fisherman-theme-bar | __fisher_name)
end
test "$TESTNAME - Remove fisherman-plugin-* prefix"
bar = (echo https://github.com/foo/fisherman-plugin-bar | __fisher_name)
end
test "$TESTNAME - Pass through other names"
bar = (echo https://github.com/foo/bar | __fisher_name)
end