Skip to content

Commit

Permalink
Deprecate bad utils functions
Browse files Browse the repository at this point in the history
_lp_bool() is a strange solution to a problem that does not really
exist. And it uses `exec`, so it really should go. I can not figure out
the last time it was actually used, but it has been a while.

_lp_sb(), _lp_sl(), and _lp_sr() are fine functions, but they use stdout
for returning, so they need to go for speed reasons.
  • Loading branch information
Rycieos committed Dec 4, 2020
1 parent bcefaf3 commit 82ee823
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions liquidprompt
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,7 @@ _lp_as_text() {
}

# Store $2 (or $?) as a true/false value in variable named $1
# $? is propagated
# _lp_bool foo 5
# => foo=false
# _lp_bool foo 0
# => foo=true
# Deprecated since v2.0.
_lp_bool() {
local res=${2:-$?}
if (( res )); then
Expand Down Expand Up @@ -642,16 +638,19 @@ __lp_pwd_tilde() {
}

# insert a space on the right
# Deprecated since v2.0.
_lp_sr() {
[[ -n "$1" ]] && echo -nE "$1 "
}

# insert a space on the left
# Deprecated since v2.0.
_lp_sl() {
[[ -n "$1" ]] && echo -nE " $1"
}

# insert two space, before and after
# Deprecated since v2.0.
_lp_sb() {
[[ -n "$1" ]] && echo -nE " $1 "
}
Expand Down

0 comments on commit 82ee823

Please sign in to comment.