From 23e310887fdbc5eda4cd5e35984992f7713dd505 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sat, 14 Oct 2023 17:20:48 +0900 Subject: [PATCH] oh-my-bash: Fix coding style --- oh-my-bash.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/oh-my-bash.sh b/oh-my-bash.sh index e669af5..9a61fa8 100644 --- a/oh-my-bash.sh +++ b/oh-my-bash.sh @@ -87,7 +87,7 @@ function _omb_module_require { status=127 done - if ((status==0)); then + if ((status == 0)); then local i for i in "${!files[@]}"; do local path=${files[i]} module=${modules[i]} @@ -117,11 +117,11 @@ _omb_module_require_lib "${_omb_init_files[@]}" unset -v _omb_init_files # Figure out the SHORT hostname -if [[ "$OSTYPE" = darwin* ]]; then +if [[ $OSTYPE = darwin* ]]; then # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible. - SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} + SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*} else - SHORT_HOST=${HOST/.*/} + SHORT_HOST=${HOST/.*} fi # Load all of the plugins that were defined in ~/.bashrc @@ -158,13 +158,18 @@ elif [[ $OSH_THEME ]]; then fi if [[ $PROMPT ]]; then - export PS1="\["$PROMPT"\]" + export PS1='\['$PROMPT'\]' fi -if ! _omb_util_command_exists '__git_ps1' ; then +if ! _omb_util_command_exists '__git_ps1'; then source "$OSH/tools/git-prompt.sh" fi # Adding Support for other OSes -[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" || -[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" || PREVIEW="less" +if [[ -s /usr/bin/gloobus-preview ]]; then + PREVIEW="gloobus-preview" +elif [[ -s /Applications/Preview.app ]]; then + PREVIEW="/Applications/Preview.app" +else + PREVIEW="less" +fi