Skip to content

Commit

Permalink
refactor: Rename "OSH => OMB"
Browse files Browse the repository at this point in the history
  • Loading branch information
nntoan authored and akinomyoga committed Jan 15, 2022
1 parent 4a608c7 commit 2e90f1f
Show file tree
Hide file tree
Showing 23 changed files with 131 additions and 131 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ _Powerline's theme is the default one. It's not the fanciest one. It's not the s
Once you find a theme that you want to use, you will need to edit the `~/.bashrc` file. You'll see an environment variable (all caps) in there that looks like:

```shell
OSH_THEME="powerline"
OMB_THEME="powerline"
```

To use a different theme, simply change the value to match the name of your desired theme. For example:

```shell
OSH_THEME="agnoster" # (this is one of the fancy ones)
OMB_THEME="agnoster" # (this is one of the fancy ones)
# you might need to install a special Powerline font on your console's host for this to work
# see https://github.com/ohmybash/oh-my-bash/wiki/Themes#agnoster
```
Expand All @@ -86,7 +86,7 @@ If you're feeling feisty, you can let the computer select one randomly for you e


```shell
OSH_THEME="random" # (...please let it be pie... please be some pie..)
OMB_THEME="random" # (...please let it be pie... please be some pie..)
```

## Advanced Topics
Expand All @@ -101,10 +101,10 @@ Some users may want to change the default path, or manually install Oh My Bash.

The default location is `~/.oh-my-bash` (hidden in your home directory)

If you'd like to change the install directory with the `OSH` environment variable, either by running `export OSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
If you'd like to change the install directory with the `OMB` environment variable, either by running `export OMB=/your/path` before installing, or by setting it before the end of the install pipeline like this:

```shell
export OSH="$HOME/.dotfiles/oh-my-bash"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.bash)"
export OMB="$HOME/.dotfiles/oh-my-bash"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.bash)"
```

#### Manual Installation
Expand Down Expand Up @@ -144,7 +144,7 @@ Once you open up a new terminal window, it should load sh with Oh My Bash's conf
If you have any hiccups installing, here are a few common fixes.

* You _might_ need to modify your `PATH` in `~/.bashrc` if you're not able to find some commands after switching to `oh-my-bash`.
* If you installed manually or changed the install location, check the `OSH` environment variable in `~/.bashrc`.
* If you installed manually or changed the install location, check the `OMB` environment variable in `~/.bashrc`.

### Custom Plugins and Themes

Expand Down
10 changes: 5 additions & 5 deletions lib/cli.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function _omb {
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(cd "$OSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
refs=("${(@f)$(cd "$OMB"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
Expand All @@ -61,19 +61,19 @@ function _omb {
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$OSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
valid_plugins=("$OMB"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OMB_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi

_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins
plugins=("$OSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
plugins=("$OMB"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OMB_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
_describe 'plugin' plugins ;;
theme::(set|use))
local -aU themes
themes=("$OSH"/themes/*.zsh-theme(.N:t:r) "$OSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$OSH_CUSTOM"/themes/:::gs:"$OSH_CUSTOM"/:::))
themes=("$OMB"/themes/*.zsh-theme(.N:t:r) "$OMB_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$OMB_CUSTOM"/themes/:::gs:"$OMB_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
Expand All @@ -85,7 +85,7 @@ function _omb {
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$OSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
valid_plugins=("$OMB"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$OMB_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
Expand Down
4 changes: 2 additions & 2 deletions lib/functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ function bash_stats() {
}

function uninstall_oh_my_bash() {
env OSH=$OSH sh $OSH/tools/uninstall.bash
env OMB=$OMB sh $OMB/tools/uninstall.bash
}

function upgrade_oh_my_bash() {
env OSH=$OSH sh $OSH/tools/upgrade.bash
env OMB=$OMB sh $OMB/tools/upgrade.bash
}

function take() {
Expand Down
70 changes: 35 additions & 35 deletions lib/git.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function git_prompt_info() {
if [[ "$(command git config --get oh-my-bash.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$OSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$OSH_THEME_GIT_PROMPT_SUFFIX"
echo "$OMB_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$OMB_THEME_GIT_PROMPT_SUFFIX"
fi
}

Expand All @@ -24,9 +24,9 @@ function parse_git_dirty() {
STATUS=$(command git status "${FLAGS[@]}" 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
echo "$OSH_THEME_GIT_PROMPT_DIRTY"
echo "$OMB_THEME_GIT_PROMPT_DIRTY"
else
echo "$OSH_THEME_GIT_PROMPT_CLEAN"
echo "$OMB_THEME_GIT_PROMPT_CLEAN"
fi
}

Expand All @@ -40,20 +40,20 @@ function git_remote_status() {
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)

if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
git_remote_status="$OSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
git_remote_status="$OMB_THEME_GIT_PROMPT_EQUAL_REMOTE"
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
git_remote_status="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
git_remote_status="$OMB_THEME_GIT_PROMPT_AHEAD_REMOTE"
git_remote_status_detailed="$OMB_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OMB_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
git_remote_status="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
git_remote_status="$OMB_THEME_GIT_PROMPT_BEHIND_REMOTE"
git_remote_status_detailed="$OMB_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OMB_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
git_remote_status="$OSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
git_remote_status="$OMB_THEME_GIT_PROMPT_DIVERGED_REMOTE"
git_remote_status_detailed="$OMB_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OMB_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$OMB_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OMB_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
fi

if [[ -n $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
git_remote_status="$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
if [[ -n $OMB_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
git_remote_status="$OMB_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OMB_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
fi

echo $git_remote_status
Expand Down Expand Up @@ -81,7 +81,7 @@ function git_commits_ahead() {
if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count @{upstream}..HEAD)"
if [[ "$commits" != 0 ]]; then
echo "$OSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$OSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
echo "$OMB_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$OMB_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi
fi
}
Expand All @@ -91,44 +91,44 @@ function git_commits_behind() {
if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count HEAD..@{upstream})"
if [[ "$commits" != 0 ]]; then
echo "$OSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$OSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
echo "$OMB_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$OMB_THEME_GIT_COMMITS_BEHIND_SUFFIX"
fi
fi
}

# Outputs if current branch is ahead of remote
function git_prompt_ahead() {
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
echo "$OSH_THEME_GIT_PROMPT_AHEAD"
echo "$OMB_THEME_GIT_PROMPT_AHEAD"
fi
}

# Outputs if current branch is behind remote
function git_prompt_behind() {
if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then
echo "$OSH_THEME_GIT_PROMPT_BEHIND"
echo "$OMB_THEME_GIT_PROMPT_BEHIND"
fi
}

# Outputs if current branch exists on remote or not
function git_prompt_remote() {
if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then
echo "$OSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
echo "$OMB_THEME_GIT_PROMPT_REMOTE_EXISTS"
else
echo "$OSH_THEME_GIT_PROMPT_REMOTE_MISSING"
echo "$OMB_THEME_GIT_PROMPT_REMOTE_MISSING"
fi
}

# Formats prompt string for current git commit short SHA
function git_prompt_short_sha() {
local SHA
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$OMB_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OMB_THEME_GIT_PROMPT_SHA_AFTER"
}

# Formats prompt string for current git commit long SHA
function git_prompt_long_sha() {
local SHA
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$OMB_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OMB_THEME_GIT_PROMPT_SHA_AFTER"
}

# Get the status of the working tree
Expand All @@ -137,44 +137,44 @@ function git_prompt_status() {
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_ADDED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_ADDED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_ADDED$STATUS"
fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_RENAMED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_RENAMED$STATUS"
fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_DELETED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_DELETED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_DELETED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_DELETED$STATUS"
fi
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
STATUS="$OSH_THEME_GIT_PROMPT_STASHED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_STASHED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_AHEAD$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_BEHIND$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
STATUS="$OSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
STATUS="$OMB_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
echo $STATUS
}
Expand Down
2 changes: 1 addition & 1 deletion lib/nvm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ function nvm_prompt_info() {
nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return
nvm_prompt=${nvm_prompt:1}
echo "${OSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${OSH_THEME_NVM_PROMPT_SUFFIX}"
echo "${OMB_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${OMB_THEME_NVM_PROMPT_SUFFIX}"
}
6 changes: 3 additions & 3 deletions lib/spectrum.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ if [ "${BASH_VERSINFO[0]}" -gt 4 ]; then
done


OSH_SPECTRUM_TEXT=${OSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
OMB_SPECTRUM_TEXT=${OMB_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}

# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
print -P -- "$code: %{$FG[$code]%}$OSH_SPECTRUM_TEXT%{$reset_color%}"
print -P -- "$code: %{$FG[$code]%}$OMB_SPECTRUM_TEXT%{$reset_color%}"
done
}

# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
for code in {000..255}; do
print -P -- "$code: %{$BG[$code]%}$OSH_SPECTRUM_TEXT%{$reset_color%}"
print -P -- "$code: %{$BG[$code]%}$OMB_SPECTRUM_TEXT%{$reset_color%}"
done
}
fi
Loading

0 comments on commit 2e90f1f

Please sign in to comment.