oh-my-bash: support OMB_THEME_RANDOM_SELECTED for the selected theme name

This commit is contained in:
Koichi Murase
2022-03-25 11:51:33 +09:00
parent 209ffda0a6
commit 8451bfabd8
2 changed files with 10 additions and 2 deletions

View File

@@ -94,11 +94,16 @@ In case you did not find a suitable theme for your needs, please have a look at
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
```shell ```shell
OSH_THEME="random" # (...please let it be pie... please be some pie..) OSH_THEME="random" # (...please let it be pie... please be some pie..)
``` ```
The selected theme name can be checked by the following command:
```shell
$ echo "$OMB_THEME_RANDOM_SELECTED"
```
## Advanced Topics ## Advanced Topics
If you're the type that likes to get their hands dirty, these sections might resonate. If you're the type that likes to get their hands dirty, these sections might resonate.

View File

@@ -134,7 +134,10 @@ if [[ $OSH_THEME == random ]]; then
if ((${#_omb_init_files[@]})); then if ((${#_omb_init_files[@]})); then
_omb_init_file=${_omb_init_files[RANDOM%${#_omb_init_files[@]}]} _omb_init_file=${_omb_init_files[RANDOM%${#_omb_init_files[@]}]}
source "$_omb_init_file" source "$_omb_init_file"
echo "[oh-my-bash] Random theme '$_omb_init_file' loaded..." OMB_THEME_RANDOM_SELECTED=${_omb_init_file##*/}
OMB_THEME_RANDOM_SELECTED=${OMB_THEME_RANDOM_SELECTED%.theme.bash}
OMB_THEME_RANDOM_SELECTED=${OMB_THEME_RANDOM_SELECTED%.theme.sh}
echo "[oh-my-bash] Random theme '$OMB_THEME_RANDOM_SELECTED' ($_omb_init_file) loaded..."
fi fi
unset -v _omb_init_files _omb_init_file unset -v _omb_init_files _omb_init_file
elif [[ $OSH_THEME ]]; then elif [[ $OSH_THEME ]]; then