Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement omb theme #620

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions lib/cli.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,43 @@ function _omb_cmd_reload {
echo 'Not yet implemented'
}
function _omb_cmd_theme {
echo 'Not yet implemented'
case "$1" in
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
list)
local -a available_themes
_comp_cmd_omb__get_available_themes
for theme in "${available_themes[@]}"; do
echo "$theme"
done
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
;;
use)
local theme=$2
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
if [[ -z "$theme" ]]; then
echo 'Usage: omb theme use <theme>'
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
return 2
fi
local -a available_themes
_comp_cmd_omb__get_available_themes
for i in "${available_themes[@]}"; do
if [ "$i" == "$theme" ]; then
_omb_module_require_theme "$theme"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_omb_module_require_theme is kind of "include once"; it checks whether the module is already loaded and loads the module only when it hasn't been loaded. So, with this implementation, one cannot switch to the theme that was loaded before.

To handle this, we may need to factorize a part of _omb_module_require (oh-my-bash.sh) into _omb_module_search and use it to obtain the location of the theme file.

return 0
fi
done
echo "Theme '$theme' not found"
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
;;
set)
echo 'Not yet implemented'
;;
*)
echo 'Usage: omb theme <command>'
echo ''
echo 'Available commands:'
echo ' list List all available themes'
echo ' set <theme> Set the given theme in your .bashrc file'
echo ' use <theme> Load the given theme'
RobLoach marked this conversation as resolved.
Show resolved Hide resolved
return 2
;;
esac
}
function _omb_cmd_update {
echo 'Not yet implemented'
Expand Down Expand Up @@ -161,7 +197,7 @@ function _comp_cmd_omb {
theme)
local -a subcmds=(
'list:List themes'
'set:Set a theme in your .zshrc file'
'set:Set a theme in your .bashrc file'
'use:Load a theme'
)
_comp_cmd_omb__describe 'command' subcmds ;;
Expand Down
19 changes: 0 additions & 19 deletions plugins/themes/README.md

This file was deleted.

33 changes: 0 additions & 33 deletions plugins/themes/themes.plugin.sh

This file was deleted.

Loading