From c5670bb9ee89e5932d83f75aa22d9a1a9cb8a7ed Mon Sep 17 00:00:00 2001 From: Itzik Ephraim Date: Fri, 4 Dec 2015 20:16:22 +0200 Subject: [PATCH] 'omf theme' now lists installed and other available themes separately. Headings are underlined. Current theme is highlighted in the Installed category. --- pkg/omf/omf.fish | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) mode change 100644 => 100755 pkg/omf/omf.fish diff --git a/pkg/omf/omf.fish b/pkg/omf/omf.fish old mode 100644 new mode 100755 index 0ea85ab..1fa5a76 --- a/pkg/omf/omf.fish +++ b/pkg/omf/omf.fish @@ -21,6 +21,10 @@ function omf::dim set_color $fish_color_autosuggestion ^/dev/null; or set_color 555 end +function omf::under + set_color --underline +end + function omf::err set_color $fish_color_error ^/dev/null; or set_color red --bold end @@ -119,13 +123,14 @@ function omf -d "Oh My Fish" case "t" "theme" if test (count $argv) -eq 1 - set -l ostype (uname) set -l theme (cat $OMF_CONFIG/theme) - set -l regex "[[:<:]]($theme)[[:>:]]" - test "$ostype" != "Darwin"; and set regex "\b($theme)\b" + set -l highlight_current "(^|[[:space:]])($theme)([[:space:]]|\$)" - omf.packages.list --database --theme | column | sed -E "s/$regex/"(omf::em)"\1"(omf::off)"/" - omf::off + echo (omf::under)"Installed:"(omf::off) + omf.packages.list --installed --theme | column | sed -E s/"$highlight_current"/"\1"(omf::em)"\2"(omf::off)"\3"/g + echo + echo (omf::under)"Available:"(omf::off) + omf.packages.list --available --theme | column else if test (count $argv) -eq 2 omf.theme $argv[2] else