From 41383d8bcbad65cefb3a70e5863330ce81f25cb2 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sun, 31 May 2015 08:30:49 -0700 Subject: [PATCH] [split] Move theme plugin to oh-my-fish/plugin-theme https://github.com/oh-my-fish/plugin-theme --- plugins/theme/README.md | 38 ------- plugins/theme/completions/theme.fish | 4 - plugins/theme/spec/theme.spec.fish | 54 ---------- plugins/theme/theme.fish | 103 ------------------- plugins/theme/theme.util.get.themes.fish | 3 - plugins/theme/theme.util.remove.current.fish | 16 --- 6 files changed, 218 deletions(-) delete mode 100644 plugins/theme/README.md delete mode 100644 plugins/theme/completions/theme.fish delete mode 100644 plugins/theme/spec/theme.spec.fish delete mode 100644 plugins/theme/theme.fish delete mode 100644 plugins/theme/theme.util.get.themes.fish delete mode 100644 plugins/theme/theme.util.remove.current.fish diff --git a/plugins/theme/README.md b/plugins/theme/README.md deleted file mode 100644 index a1b71e7..0000000 --- a/plugins/theme/README.md +++ /dev/null @@ -1,38 +0,0 @@ -## _theme_ :tophat: -> Quick theme switcher. - -## Description -Quick theme switcher for _Oh my fish_. _theme_ is smart to auto-complete as you type all the available _oh-my-fish_ themes. - -![mov](https://cloud.githubusercontent.com/assets/8317250/6200763/8593a226-b4c9-11e4-9845-597be49d3233.gif) - - -## Options - -#### `theme ` - - Quick switch to theme. - -#### `theme -l --list` - - List available themes. - -#### `theme -r --restore` - - Restore original theme. - -#### `theme -h --help` - - Show usage help. - -## Authors - -+ [Jorge Bucaran](https://github.com/bucaran) - -## Credits - -+ Auto-completions thanks to [Bruno Pinto](https://github.com/bpinto). - -## License - -MIT diff --git a/plugins/theme/completions/theme.fish b/plugins/theme/completions/theme.fish deleted file mode 100644 index 5780ca2..0000000 --- a/plugins/theme/completions/theme.fish +++ /dev/null @@ -1,4 +0,0 @@ -# Add completions when the theme is loaded. Thanks Bruno! -complete --command (basename -s.fish (status -f)) \ - --arguments "(basename (theme.util.get.themes))" \ - --description "Oh-my-fish theme" diff --git a/plugins/theme/spec/theme.spec.fish b/plugins/theme/spec/theme.spec.fish deleted file mode 100644 index c77e361..0000000 --- a/plugins/theme/spec/theme.spec.fish +++ /dev/null @@ -1,54 +0,0 @@ -import plugins/fish-spec -import plugins/theme - -function describe_theme -d "theme: quick theme switcher" - function before_all - set -g __theme_test_last_theme $fish_theme - end - - function it_changes_the_current_theme - theme bobthefish - expect $fish_theme --to-equal bobthefish - and expect $fish_function_path --to-contain-all $fish_path/themes/bobthefish - end - - function it_restores_the_original_theme - theme bobthefish - theme -r - expect $fish_theme --to-equal $__theme_test_last_theme - end - - function it_prints_usage_help - expect (theme -h | grep USAGE | sed -E 's/ //g') --to-equal "USAGE" - end - - function it_prints_a_list_of_all_themes - set -l themes (theme -l) - for theme in $fish_custom/themes/* $fish_path/themes/* - set theme (basename "$theme") - expect (echo "$themes" | grep -o "$theme") --to-equal "$theme" - end - end - - function it_highlights_the_currently_selected_theme - set -l themes (theme -l) - expect (echo "$themes" | grep -o "$fish_theme\*") --to-equal "$fish_theme*" - end - - function it_can_reload_a_theme_multiple_times - theme bobthefish - theme fishface - theme bobthefish - expect $fish_theme --to-equal bobthefish - and expect $fish_function_path --to-contain-all $fish_path/themes/bobthefish - and expect $fish_function_path --to-not-contain-all $fish_path/themes/fishface - end - - function it_returns_1_if_the_theme_does_not_exist - set -l improbable_theme ___(date +%s)___ - set -l ignore_output (theme "$improbable_theme") - expect $status --to-equal 1 - end -end - -spec.run $argv diff --git a/plugins/theme/theme.fish b/plugins/theme/theme.fish deleted file mode 100644 index 6437a9b..0000000 --- a/plugins/theme/theme.fish +++ /dev/null @@ -1,103 +0,0 @@ -# NAME -# theme - quick theme switcher -# -# DESCRIPTION -# Quick theme switcher for Oh my fish. theme is smart to auto-complete -# as you type from the list available _oh-my-fish_ themes. -# -# SYNOPSIS -# theme -# [-l --list] -# [-u --update] -# [-r --restore] -# [-h --help] -# -# OPTIONS -# theme -# Quick switch to theme. -# -# theme -l --list -# List available themes. -# -# theme -u --update -# Update theme auto-completions. -# -# theme -r --restore -# Restore original theme. -# -# theme -h --help -# Show usage help. -# -# AUTHORS -# Jorge Bucaran -# / - -if not set -q __fish_theme_last - set -g __fish_theme_last $fish_theme -end - -function theme -d "quick theme switcher" - set -l usage " - USAGE - $_ - Quick switch to theme. - - $_ -l --list - List available themes. - - $_ -r --restore - Restore original theme. - - $_ -h --help - Show usage help. - " - if test (count $argv) -gt 0 - set -l option $argv[1] - switch $option - case -h --help help - echo $usage - - case -l --list - set -l regex "[[:<:]]($fish_theme)[[:>:]]" - if test (uname) != "Darwin" - set regex "\b($fish_theme)\b" - end - set -l color green - for theme in (theme.util.get.themes) - basename $theme \ - | sed -E "s/$regex/"(set_color $color)"\1*"(set_color normal)"/" - end | column - set_color normal - - case -r --restore - if set -q __fish_theme_last - if test $__fish_theme_last != $fish_theme - theme.util.remove.current - - set fish_theme $__fish_theme_last - . $fish_path/oh-my-fish.fish - end - end - - case \* - if test -z "$option" - echo $usage - - else if test -d $fish_custom/themes/$option -o \ - -d $fish_path/themes/$option - - theme.util.remove.current - - set fish_theme $option - . $fish_path/oh-my-fish.fish - - else - echo (set_color f00)"`$option` is not a theme."(set_color normal) ^&2 - theme --list - return 1 - end - end - else - theme --list - end -end diff --git a/plugins/theme/theme.util.get.themes.fish b/plugins/theme/theme.util.get.themes.fish deleted file mode 100644 index f6548d6..0000000 --- a/plugins/theme/theme.util.get.themes.fish +++ /dev/null @@ -1,3 +0,0 @@ -function theme.util.get.themes - printf "%s\n" $fish_path/themes/* -end diff --git a/plugins/theme/theme.util.remove.current.fish b/plugins/theme/theme.util.remove.current.fish deleted file mode 100644 index 69a9b6e..0000000 --- a/plugins/theme/theme.util.remove.current.fish +++ /dev/null @@ -1,16 +0,0 @@ -function theme.util.remove.current - # Find previously loaded theme index in function path. - set -l index (contains -i -- \ - $fish_custom/themes/$fish_theme $fish_function_path) - - if test $status -gt 0 - # Not a custom theme, try a default theme. - set index (contains -i -- \ - $fish_path/themes/$fish_theme $fish_function_path) - end - - if test -n "$index" - # So Long, and Thanks for All the Fish. - set -e fish_function_path[$index] - end -end