mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
themes/random: add OMB_THEME_RANDOM_IGNORED (#498)
This commit is contained in:
@ -109,6 +109,12 @@ If you're feeling feisty, you can let the computer select one randomly for you e
|
||||
OSH_THEME="random" # (...please let it be pie... please be some pie..)
|
||||
```
|
||||
|
||||
If there are themes you don't like, you can add them to an ignored list:
|
||||
|
||||
```shell
|
||||
OMB_THEME_RANDOM_IGNORED=("powerbash10k" "wanelo")
|
||||
```
|
||||
|
||||
The selected theme name can be checked by the following command:
|
||||
|
||||
```shell
|
||||
|
@ -144,6 +144,18 @@ unset -v _omb_init_files _omb_init_file
|
||||
# Load the theme
|
||||
if [[ $OSH_THEME == random ]]; then
|
||||
_omb_util_glob_expand _omb_init_files '"$OSH"/themes/*/*.theme.sh'
|
||||
|
||||
# Remove ignored themes from the list
|
||||
for _omb_init_theme in random "${OMB_THEME_RANDOM_IGNORED[@]}"; do
|
||||
for _omb_init_index in "${!_omb_init_files[@]}"; do
|
||||
[[ ${_omb_init_files[_omb_init_index]} == */"$_omb_init_theme"/* ]] &&
|
||||
unset -v '_omb_init_files[_omb_init_index]'
|
||||
done
|
||||
unset -v _omb_init_index
|
||||
done
|
||||
unset -v _omb_init_theme
|
||||
_omb_init_files=("${_omb_init_files[@]}")
|
||||
|
||||
if ((${#_omb_init_files[@]})); then
|
||||
_omb_init_file=${_omb_init_files[RANDOM%${#_omb_init_files[@]}]}
|
||||
source "$_omb_init_file"
|
||||
|
@ -11,6 +11,9 @@ export OSH=~/.oh-my-bash
|
||||
# it'll load a random theme each time that oh-my-bash is loaded.
|
||||
OSH_THEME="font"
|
||||
|
||||
# If you set OSH_THEME to "random", you can ignore themes you don't like.
|
||||
# OMB_THEME_RANDOM_IGNORED=("powerbash10k" "wanelo")
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# OMB_CASE_SENSITIVE="true"
|
||||
|
||||
|
Reference in New Issue
Block a user