Skip to content

Commit

Permalink
Changed 'echo' to printf/_omb_util_put/_omb_util_print as appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Witten committed Sep 9, 2024
1 parent a940c69 commit 13038f5
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions lib/cli.bash
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#!/usr/bin/env bash
#!/usr/bin/env -S bash

_omb_module_require lib:utils

function _omb_cmd_help {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_changelog {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_plugin {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_pull {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_reload {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_theme {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_update {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}
function _omb_cmd_version {
echo 'Not yet implemented'
_omb_util_print 'Not yet implemented'
}

function omb {
Expand Down
12 changes: 6 additions & 6 deletions lib/mo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function mo {
# shellcheck disable=SC1090
. "$f2source"
else
echo "No such file: $f2source" >&2
_omb_util_print "No such file: $f2source" >&2
exit 1
fi
;;
Expand Down Expand Up @@ -495,7 +495,7 @@ function _moLoadFile {
# a dot to the content to preserve all newlines.
# TODO: remove cat and replace with read loop?

content=$(cat -- "$2"; echo '.')
content=$(cat -- "$2"; _omb_util_print '.')
len=$((${#content} - 1))
content=${content:0:$len} # Remove last dot

Expand Down Expand Up @@ -651,7 +651,7 @@ function _moParse {
_moSplit moContent "$moContent" '{{' '}}'
done

echo -n "${moContent[0]}"
_omb_util_put "${moContent[0]}"
}


Expand All @@ -675,12 +675,12 @@ function _moPartial {

if _moIsStandalone moStandalone "$2" "$4" "$5"; then
moStandalone=( $moStandalone )
echo -n "${2:0:${moStandalone[0]}}"
_omb_util_put "${2:0:${moStandalone[0]}}"
moIndent=${2:${moStandalone[0]}}
moContent=${4:${moStandalone[1]}}
else
moIndent=""
echo -n "$2"
_omb_util_put "$2"
moContent=$4
fi

Expand All @@ -695,7 +695,7 @@ function _moPartial {
# Fix bash handling of subshells
# The extra dot is removed in _moIndentLines
echo -n "${moPartial}."
_omb_util_put "${moPartial}."
)"
_moParse "$moPartial" "$6" true
)
Expand Down
20 changes: 10 additions & 10 deletions lib/omb-prompt-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function scm_prompt_info {

function scm_prompt_char_info {
scm_prompt_char
echo -ne "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
_omb_util_put "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
scm_prompt_info_common
}

Expand Down Expand Up @@ -212,7 +212,7 @@ function git_prompt_minimal_info {
# Output the git prompt
SCM_PREFIX=${SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${SCM_THEME_PROMPT_SUFFIX}
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
_omb_util_print "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
fi
}

Expand Down Expand Up @@ -563,7 +563,7 @@ function clock_char {
SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}

if [[ "${SHOW_CLOCK_CHAR}" = "true" ]]; then
echo -e "${CLOCK_CHAR_COLOR}${CLOCK_CHAR_THEME_PROMPT_PREFIX}${CLOCK_CHAR}${CLOCK_CHAR_THEME_PROMPT_SUFFIX}"
_omb_util_print "${CLOCK_CHAR_COLOR}${CLOCK_CHAR_THEME_PROMPT_PREFIX}${CLOCK_CHAR}${CLOCK_CHAR_THEME_PROMPT_SUFFIX}"
fi
}

Expand All @@ -575,35 +575,35 @@ function clock_prompt {

if [[ "${SHOW_CLOCK}" = "true" ]]; then
CLOCK_STRING=$(date +"${CLOCK_FORMAT}")
echo -e "${CLOCK_COLOR}${CLOCK_THEME_PROMPT_PREFIX}${CLOCK_STRING}${CLOCK_THEME_PROMPT_SUFFIX}"
_omb_util_print "${CLOCK_COLOR}${CLOCK_THEME_PROMPT_PREFIX}${CLOCK_STRING}${CLOCK_THEME_PROMPT_SUFFIX}"
fi
}

function user_host_prompt {
if [[ "${THEME_SHOW_USER_HOST}" = "true" ]]; then
echo -e "${USER_HOST_THEME_PROMPT_PREFIX}\u@\h${USER_HOST_THEME_PROMPT_SUFFIX}"
_omb_util_print "${USER_HOST_THEME_PROMPT_PREFIX}\u@\h${USER_HOST_THEME_PROMPT_SUFFIX}"
fi
}

# backwards-compatibility
function git_prompt_info {
git_prompt_vars
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
_omb_util_print "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
}

function svn_prompt_info {
svn_prompt_vars
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
_omb_util_print "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
}

function hg_prompt_info() {
hg_prompt_vars
echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE#*:}${SCM_STATE}${SCM_SUFFIX}"
_omb_util_print "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE#*:}${SCM_STATE}${SCM_SUFFIX}"
}

function scm_char {
scm_prompt_char
echo -e "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
_omb_util_print "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
}

function prompt_char {
Expand All @@ -612,7 +612,7 @@ function prompt_char {

function battery_char {
if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then
echo -e "${_omb_prompt_bold_brown}$(battery_percentage)%"
_omb_util_print "${_omb_prompt_bold_brown}$(battery_percentage)%"
fi
}

Expand Down
6 changes: 3 additions & 3 deletions lib/spinner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#
# Examples
#
# echo -ne "${_omb_term_brown}I am running..."
# _omb_util_put "${_omb_term_brown}I am running..."
# ( my_long_task_running ) &
# spinner
# echo -ne "...${_omb_term_reset} ${_omb_term_green}DONE${_omb_term_reset}"
# _omb_util_put "...${_omb_term_reset} ${_omb_term_green}DONE${_omb_term_reset}"
#

# This spinner is used when there is a terminal.
Expand All @@ -34,7 +34,7 @@ function no_term_spinner {
printf "."
sleep 2
done
echo ""
_omb_util_print ""
}

function spinner {
Expand Down
6 changes: 3 additions & 3 deletions themes/dulcie/dulcie.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ DULCIE_COLOR=${DULCIE_COLOR:=1} # 0 = monochrome, 1 = colorful
DULCIE_MULTILINE=${DULCIE_MULTILINE:=1} # 0 = Single line, 1 = SCM in separate line

function dulcie_color {
echo -en "\[\e[38;5;${1}m\]"
_omb_util_put "\[\e[38;5;${1}m\]"
}

function dulcie_background {
echo -en "\[\e[48;5;${1}m\]"
_omb_util_put "\[\e[48;5;${1}m\]"
}

function _omb_theme_PROMPT_COMMAND {
Expand Down Expand Up @@ -74,7 +74,7 @@ function _omb_theme_PROMPT_COMMAND {
fi

# Change terminal title
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
_omb_util_put "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"

# Open the new terminal in the same directory
_omb_util_function_exists __vte_osc7 && __vte_osc7
Expand Down
2 changes: 1 addition & 1 deletion themes/iterate/iterate.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RBFU_THEME_PROMPT_SUFFIX="| "

function git_prompt_info {
git_prompt_vars
echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX"
_omb_util_print "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX"
}

LAST_PROMPT=""
Expand Down
2 changes: 1 addition & 1 deletion themes/nwinkler/nwinkler.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PROMPT_END_CLEAN="${_omb_prompt_green}→${_omb_prompt_reset_color}"
PROMPT_END_DIRTY="${_omb_prompt_brown}${_omb_prompt_reset_color}"

function prompt_end() {
echo -e "$PROMPT_END"
_omb_util_print "$PROMPT_END"
}

function _omb_theme_PROMPT_COMMAND {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PROMPT_END_CLEAN="${_omb_prompt_green}→${_omb_prompt_reset_color}"
PROMPT_END_DIRTY="${_omb_prompt_brown}${_omb_prompt_reset_color}"

function prompt_end() {
echo -e "$PROMPT_END"
_omb_util_print "$PROMPT_END"
}

function _omb_theme_PROMPT_COMMAND {
Expand Down
2 changes: 1 addition & 1 deletion themes/powerline/powerline.base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function set_color {
fi
fi

echo -e "\[\033[${fg}${fg:+${bg:+;}}${bg}m\]"
_omb_util_print "\[\033[${fg}${fg:+${bg:+;}}${bg}m\]"
}

function __powerline_user_info_prompt {
Expand Down
2 changes: 1 addition & 1 deletion themes/pro/pro.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GIT_THEME_PROMPT_SUFFIX="${_omb_prompt_green} )"

function git_prompt_info {
git_prompt_vars
echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_SUFFIX"
_omb_util_print "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_SUFFIX"
}

function _omb_theme_PROMPT_COMMAND() {
Expand Down
2 changes: 1 addition & 1 deletion themes/rana/rana.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function prompt_git {

[[ $s ]] && s=" [$s]"

echo -e "${1}${branchName}${_omb_prompt_teal}$s"
_omb_util_print "${1}${branchName}${_omb_prompt_teal}$s"
else
return
fi
Expand Down

0 comments on commit 13038f5

Please sign in to comment.