mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-09-21 02:17:11 +00:00
feat(lib/omb-util): add "_omb_util_{print,put}"
This commit is contained in:
parent
382ecf151f
commit
4b95670330
@ -27,7 +27,7 @@
|
||||
# 1. FILE AND FOLDER MANAGEMENT
|
||||
# -------------------------------
|
||||
|
||||
alias numFiles='echo $(ls -1 | wc -l)' # numFiles: Count of non-hidden files in current dir
|
||||
alias numFiles='_omb_util_print $(ls -1 | wc -l)' # numFiles: Count of non-hidden files in current dir
|
||||
alias make1mb='truncate -s 1m ./1MB.dat' # make1mb: Creates a file of 1mb size (all zeros)
|
||||
alias make5mb='truncate -s 5m ./5MB.dat' # make5mb: Creates a file of 5mb size (all zeros)
|
||||
alias make10mb='truncate -s 10m ./10MB.dat' # make10mb: Creates a file of 10mb size (all zeros)
|
||||
@ -95,7 +95,7 @@ alias mountReadWrite='mount -uw /' # mountReadWrite: For use when booted in
|
||||
alias bdate="date '+%a, %b %d %Y %T %Z'"
|
||||
alias cal3='cal -3'
|
||||
alias da='date "+%Y-%m-%d %A %T %Z"'
|
||||
alias daysleft='echo "There are $(($(date +%j -d"Dec 31, $(date +%Y)")-$(date +%j))) left in year $(date +%Y)."'
|
||||
alias daysleft='_omb_util_print "There are $(($(date +%j -d"Dec 31, $(date +%Y)")-$(date +%j))) left in year $(date +%Y)."'
|
||||
alias epochtime='date +%s'
|
||||
alias mytime='date +%H:%M:%S'
|
||||
alias secconvert='date -d@1234567890'
|
||||
|
@ -66,7 +66,7 @@ function _omb_completion_django_init {
|
||||
python=${python##*/}
|
||||
[[ $python ]] && pythons+=("$python")
|
||||
done
|
||||
_omb_util_split pythons "$(printf '%s\n' "${pythons[@]}" | sort -u)" $'\n'
|
||||
_omb_util_split pythons "$(_omb_util_print_lines "${pythons[@]}" | sort -u)" $'\n'
|
||||
fi
|
||||
|
||||
complete -F _omb_completion_django_python -o default "${pythons[@]}"
|
||||
|
@ -278,7 +278,7 @@ EOF
|
||||
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
||||
function __hub_github_user {
|
||||
if [ -n "$GITHUB_USER" ]; then
|
||||
echo $GITHUB_USER
|
||||
_omb_util_print $GITHUB_USER
|
||||
return
|
||||
fi
|
||||
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/gh}
|
||||
@ -299,7 +299,7 @@ EOF
|
||||
k=${k#* }
|
||||
v=${v#* }
|
||||
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
||||
echo "$v"
|
||||
_omb_util_print "$v"
|
||||
break
|
||||
fi
|
||||
done < "$config"
|
||||
@ -343,7 +343,7 @@ EOF
|
||||
repo=${i#*:}
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/remotes/${remote}/" | while read branch; do
|
||||
echo "${repo}:${branch#${remote}/}"
|
||||
_omb_util_print "${repo}:${branch#${remote}/}"
|
||||
done
|
||||
done
|
||||
fi
|
||||
@ -357,7 +357,7 @@ EOF
|
||||
if [ -d "$dir" ]; then
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/remotes/${remote}/" | while read i; do
|
||||
echo "${i#${remote}/}"
|
||||
_omb_util_print "${i#${remote}/}"
|
||||
done
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/tags/"
|
||||
|
@ -547,7 +547,7 @@ __git_flow_prefix ()
|
||||
{
|
||||
case "$1" in
|
||||
feature|bugfix|release|hotfix|support)
|
||||
_omb_prompt_git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
|
||||
_omb_prompt_git config "gitflow.prefix.$1" 2> /dev/null || _omb_util_print "$1/"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
@ -561,7 +561,7 @@ __git_flow_list_local_branches ()
|
||||
while read -r entry; do
|
||||
eval "$entry"
|
||||
ref="${ref#$prefix}"
|
||||
echo "$ref"
|
||||
_omb_util_print "$ref"
|
||||
done | sort
|
||||
else
|
||||
_omb_prompt_git for-each-ref --format="ref=%(refname:short)" refs/heads/ | sort
|
||||
@ -572,25 +572,25 @@ __git_flow_list_local_branches ()
|
||||
__git_flow_list_remote_branches ()
|
||||
{
|
||||
local prefix="$(__git_flow_prefix $1)"
|
||||
local origin="$(_omb_prompt_git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||
local origin="$(_omb_prompt_git config gitflow.origin 2> /dev/null || _omb_util_print "origin")"
|
||||
_omb_prompt_git for-each-ref --shell --format='%(refname:short)' refs/remotes/$origin/$prefix | \
|
||||
while read -r entry; do
|
||||
eval "$entry"
|
||||
ref="${ref##$prefix}"
|
||||
echo "$ref"
|
||||
_omb_util_print "$ref"
|
||||
done | sort
|
||||
}
|
||||
|
||||
__git_flow_list_branches ()
|
||||
{
|
||||
local origin="$(_omb_prompt_git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||
local origin="$(_omb_prompt_git config gitflow.origin 2> /dev/null || _omb_util_print "origin")"
|
||||
if [ -n "$1" ]; then
|
||||
local prefix="$(__git_flow_prefix $1)"
|
||||
_omb_prompt_git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix refs/remotes/$origin/$prefix | \
|
||||
while read -r entry; do
|
||||
eval "$entry"
|
||||
ref="${ref##$prefix}"
|
||||
echo "$ref"
|
||||
_omb_util_print "$ref"
|
||||
done | sort
|
||||
else
|
||||
_omb_prompt_git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort
|
||||
|
@ -25,18 +25,18 @@ function __gradle {
|
||||
newest_gradle_file=$(find . -type f -name build.gradle -newer "$cache_dir/$gradle_files_checksum")
|
||||
if [[ $newest_gradle_file ]]; then
|
||||
tasks=$(eval "$parsing_command")
|
||||
[[ $tasks ]] && echo "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
[[ $tasks ]] && _omb_util_print "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
else
|
||||
tasks=$(< "$cache_dir/$gradle_files_checksum")
|
||||
touch "$cache_dir/$gradle_files_checksum"
|
||||
fi
|
||||
else
|
||||
tasks=$(eval "$parsing_command")
|
||||
[[ $tasks ]] && echo "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
[[ $tasks ]] && _omb_util_print "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
fi
|
||||
else
|
||||
tasks=$(eval "$parsing_command")
|
||||
[[ $tasks ]] && echo "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
[[ $tasks ]] && _omb_util_print "$tasks" > "$cache_dir/$gradle_files_checksum"
|
||||
fi
|
||||
COMPREPLY=($(compgen -W "$tasks" -- "$cur"))
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ function _grunt_gruntfile {
|
||||
local gruntfile
|
||||
for gruntfile in "$curpath"/{G,g}runtfile.{js,coffee}; do
|
||||
if [[ -e $gruntfile ]]; then
|
||||
echo "$gruntfile"
|
||||
_omb_util_print "$gruntfile"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
@ -300,7 +300,7 @@ EOF
|
||||
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
||||
function __hub_github_user {
|
||||
if [ -n "$GITHUB_USER" ]; then
|
||||
echo $GITHUB_USER
|
||||
_omb_util_print $GITHUB_USER
|
||||
return
|
||||
fi
|
||||
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/hub}
|
||||
@ -321,7 +321,7 @@ EOF
|
||||
k=${k#* }
|
||||
v=${v#* }
|
||||
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
||||
echo "$v"
|
||||
_omb_util_print "$v"
|
||||
break
|
||||
fi
|
||||
done < "$config"
|
||||
@ -365,7 +365,7 @@ EOF
|
||||
repo=${i#*:}
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/remotes/${remote}/" | while read branch; do
|
||||
echo "${repo}:${branch#${remote}/}"
|
||||
_omb_util_print "${repo}:${branch#${remote}/}"
|
||||
done
|
||||
done
|
||||
fi
|
||||
@ -379,7 +379,7 @@ EOF
|
||||
if [ -d "$dir" ]; then
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/remotes/${remote}/" | while read i; do
|
||||
echo "${i#${remote}/}"
|
||||
_omb_util_print "${i#${remote}/}"
|
||||
done
|
||||
_omb_prompt_git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||
"refs/tags/"
|
||||
|
@ -57,9 +57,9 @@ function __find_mvn_projects {
|
||||
local withoutPom=${LINE%/pom.xml}
|
||||
local module=${withoutPom#./}
|
||||
if [[ ! $module ]]; then
|
||||
echo "."
|
||||
_omb_util_print "."
|
||||
else
|
||||
echo $module
|
||||
_omb_util_print $module
|
||||
fi
|
||||
done
|
||||
}
|
||||
@ -89,7 +89,7 @@ function _realpath {
|
||||
}
|
||||
|
||||
# reassemble realpath
|
||||
echo "$tmppwd/${1##*/}"
|
||||
_omb_util_print "$tmppwd/${1##*/}"
|
||||
return 1 #success
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ if ! declare -F __sdkman_build_version_csv &>/dev/null; then
|
||||
done
|
||||
versions_csv=${versions_csv%?}
|
||||
fi
|
||||
echo "$versions_csv"
|
||||
_omb_util_print "$versions_csv"
|
||||
}
|
||||
fi
|
||||
|
||||
|
@ -67,7 +67,7 @@ function _tmux {
|
||||
local skip_next=0
|
||||
for ((i = 1; i <= COMP_CWORD; i++)); do
|
||||
if ((skip_next == 1)); then
|
||||
#echo "Skipping"
|
||||
#_omb_util_print "Skipping"
|
||||
skip_next=0;
|
||||
elif [[ ${COMP_WORDS[i]} != -* ]]; then
|
||||
cmd=${COMP_WORDS[i]}
|
||||
@ -82,7 +82,7 @@ function _tmux {
|
||||
skip_next=0
|
||||
for ((i = 1; i <= COMP_CWORD; i++)); do
|
||||
if ((skip_next == 1)); then
|
||||
#echo "Skipping"
|
||||
#_omb_util_print "Skipping"
|
||||
skip_next=0
|
||||
elif [[ ${COMP_WORDS[i]} == -* ]]; then
|
||||
option=${COMP_WORDS[i]}
|
||||
|
@ -33,19 +33,19 @@ function __pwdln {
|
||||
((itr++))
|
||||
pwdmod="${pwdmod#*/}"
|
||||
done
|
||||
echo -n $((itr-1))
|
||||
_omb_util_put $((itr-1))
|
||||
}
|
||||
|
||||
function __vagrantinvestigate {
|
||||
if [[ -f $PWD/.vagrant || -d $PWD/.vagrant ]]; then
|
||||
echo "$PWD/.vagrant"
|
||||
_omb_util_print "$PWD/.vagrant"
|
||||
return 0
|
||||
else
|
||||
pwdmod2=$PWD
|
||||
for ((i = 2; i <= $(__pwdln); i++)); do
|
||||
pwdmod2=${pwdmod2%/*}
|
||||
if [[ -f $pwdmod2/.vagrant || -d $pwdmod2/.vagrant ]]; then
|
||||
echo "$pwdmod2/.vagrant"
|
||||
_omb_util_print "$pwdmod2/.vagrant"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
@ -1,4 +1,11 @@
|
||||
#! bash oh-my-bash.module
|
||||
#
|
||||
# Taken from https://github.com/iljaweis/vault-bash-completion
|
||||
#
|
||||
# * 2024-08-13 Confirmed that the current version is up-to-date with the
|
||||
# archived version:
|
||||
# https://github.com/iljaweis/vault-bash-completion/blob/c42047c5bd6aca9045b7945db1c41654080076e1/vault-bash-completion.sh
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
# vault-bash-completion
|
||||
#
|
||||
@ -11,7 +18,7 @@ function _vault_mounts {
|
||||
(
|
||||
set -euo pipefail
|
||||
if ! vault mounts 2> /dev/null | awk 'NR > 1 {print $1}'; then
|
||||
echo "secret"
|
||||
_omb_util_print "secret"
|
||||
fi
|
||||
)
|
||||
}
|
||||
@ -31,7 +38,7 @@ function _vault {
|
||||
if [[ $prev =~ ^(policies|policy-write|policy-delete) ]]; then
|
||||
local policies=$(vault policies 2> /dev/null)
|
||||
COMPREPLY=($(compgen -W "$policies" -- $cur))
|
||||
elif (($(echo "$line" | wc -w) <= 2)); then
|
||||
elif (($(wc -w <<< "$line") <= 2)); then
|
||||
if [[ $line =~ ^vault\ (read|write|delete|list)\ $ ]]; then
|
||||
COMPREPLY=($(compgen -W "$(_vault_mounts)" -- ''))
|
||||
else
|
||||
|
@ -35,8 +35,8 @@ function _vboxmanage {
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# echo "cur: |$cur|"
|
||||
# echo "prev: |$prev|"
|
||||
# _omb_util_print "cur: |$cur|"
|
||||
# _omb_util_print "prev: |$prev|"
|
||||
|
||||
case $prev in
|
||||
-v|--version)
|
||||
@ -75,7 +75,7 @@ function _vboxmanage {
|
||||
;;
|
||||
esac
|
||||
|
||||
# echo "Got vboxmanage"
|
||||
# _omb_util_print "Got vboxmanage"
|
||||
opts=$(__vboxmanage_default)
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
@ -101,7 +101,7 @@ function _vboxmanage {
|
||||
for VM in $(__vboxmanage_list_vms); do
|
||||
if [ "$VM" == "$prev" ]; then
|
||||
pprev=${COMP_WORDS[COMP_CWORD-2]}
|
||||
# echo "previous: $pprev"
|
||||
# _omb_util_print "previous: $pprev"
|
||||
case $pprev in
|
||||
startvm)
|
||||
opts="--type"
|
||||
@ -127,16 +127,16 @@ function _vboxmanage {
|
||||
fi
|
||||
done
|
||||
|
||||
# echo "Got to end withoug completion"
|
||||
# _omb_util_print "Got to end withoug completion"
|
||||
}
|
||||
|
||||
function _vboxmanage_realopts {
|
||||
echo $(vboxmanage | grep -Eo "^\s{2}[a-z]+")
|
||||
echo " "
|
||||
_omb_util_print $(vboxmanage | grep -Eo "^\s{2}[a-z]+")
|
||||
_omb_util_print " "
|
||||
}
|
||||
|
||||
function __vboxmanage_nic_types {
|
||||
echo $(vboxmanage |
|
||||
_omb_util_print $(vboxmanage |
|
||||
grep ' nic<' |
|
||||
sed 's/.*nic<1-N> \([a-z\|]*\).*/\1/' | tr '|' ' ')
|
||||
}
|
||||
@ -155,7 +155,7 @@ function __vboxmanage_startvm {
|
||||
done
|
||||
(( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM "
|
||||
done
|
||||
echo $AVAILABLE
|
||||
_omb_util_print $AVAILABLE
|
||||
}
|
||||
|
||||
function __vboxmanage_list {
|
||||
@ -173,7 +173,7 @@ function __vboxmanage_list {
|
||||
PRUNED=$INPUT
|
||||
fi
|
||||
|
||||
echo $PRUNED
|
||||
_omb_util_print $PRUNED
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ function __vboxmanage_list_vms {
|
||||
VMS="${VMS}${VM}"
|
||||
done
|
||||
|
||||
echo $VMS
|
||||
_omb_util_print $VMS
|
||||
}
|
||||
|
||||
function __vboxmanage_list_runningvms {
|
||||
@ -206,21 +206,21 @@ function __vboxmanage_list_runningvms {
|
||||
VMS="${VMS}${VM}"
|
||||
done
|
||||
|
||||
echo $VMS
|
||||
_omb_util_print $VMS
|
||||
}
|
||||
|
||||
function __vboxmanage_controlvm {
|
||||
echo "pause resume reset poweroff savestate acpipowerbutton"
|
||||
echo "acpisleepbutton keyboardputscancode guestmemoryballoon"
|
||||
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
|
||||
echo "vrdeproperty vrdevideochannelquality setvideomodehint"
|
||||
echo "screenshotpng setcredentials teleport plugcpu unplugcpu"
|
||||
echo "cpuexecutioncap"
|
||||
_omb_util_print "pause resume reset poweroff savestate acpipowerbutton"
|
||||
_omb_util_print "acpisleepbutton keyboardputscancode guestmemoryballoon"
|
||||
_omb_util_print "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
|
||||
_omb_util_print "vrdeproperty vrdevideochannelquality setvideomodehint"
|
||||
_omb_util_print "screenshotpng setcredentials teleport plugcpu unplugcpu"
|
||||
_omb_util_print "cpuexecutioncap"
|
||||
|
||||
# setlinkstate<1-N>
|
||||
activenics=$(__vboxmanage_showvminfo_active_nics $1)
|
||||
for nic in $(echo "${activenics}" | tr -d 'nic'); do
|
||||
echo "setlinkstate${nic}"
|
||||
for nic in $(_omb_util_print "${activenics}" | tr -d 'nic'); do
|
||||
_omb_util_print "setlinkstate${nic}"
|
||||
done
|
||||
|
||||
# nic<1-N> null|nat|bridged|intnet|hostonly|generic
|
||||
@ -240,14 +240,14 @@ function __vboxmanage_modifyvm {
|
||||
for i in {1..8}; do
|
||||
options="$options --nic${i}"
|
||||
done
|
||||
echo $options
|
||||
_omb_util_print $options
|
||||
}
|
||||
|
||||
function __vboxmanage_showvminfo_active_nics {
|
||||
nics=$(vboxmanage showvminfo $1 --machinereadable |
|
||||
awk '/^nic/ && ! /none/' |
|
||||
awk '{ split($1, names, "="); print names[1] }')
|
||||
echo $nics
|
||||
_omb_util_print $nics
|
||||
}
|
||||
|
||||
function __vboxmanage_default {
|
||||
@ -255,12 +255,12 @@ function __vboxmanage_default {
|
||||
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
|
||||
pruned=""
|
||||
|
||||
# echo ""
|
||||
# echo "DEBUG: cur: $cur, prev: $prev"
|
||||
# echo "DEBUG: default: |$p1|$p2|$p3|$p4|"
|
||||
# _omb_util_print ""
|
||||
# _omb_util_print "DEBUG: cur: $cur, prev: $prev"
|
||||
# _omb_util_print "DEBUG: default: |$p1|$p2|$p3|$p4|"
|
||||
case ${cur} in
|
||||
-*)
|
||||
echo $opts
|
||||
_omb_util_print $opts
|
||||
# COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
@ -269,7 +269,7 @@ function __vboxmanage_default {
|
||||
for WORD in $opts; do
|
||||
MATCH=0
|
||||
for OPT in ${COMP_WORDS[@]}; do
|
||||
# opts=$(echo ${opts} | grep -v $OPT);
|
||||
# opts=$(_omb_util_print ${opts} | grep -v $OPT);
|
||||
if [ "$OPT" == "$WORD" ]; then
|
||||
MATCH=1
|
||||
break;
|
||||
@ -297,6 +297,6 @@ function __vboxmanage_default {
|
||||
done
|
||||
|
||||
# COMPREPLY=($(compgen -W "${pruned}" -- ${cur}))
|
||||
echo $pruned
|
||||
_omb_util_print $pruned
|
||||
return 0
|
||||
}
|
||||
|
47
lib/base.sh
47
lib/base.sh
@ -99,10 +99,10 @@ function extract {
|
||||
*.zip) unzip "$1" ;;
|
||||
*.Z) uncompress "$1" ;;
|
||||
*.7z) 7z x "$1" ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
*) _omb_util_print "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
_omb_util_print "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -144,13 +144,13 @@ function mkiso {
|
||||
fi
|
||||
|
||||
if [ ! -f "${destpath}${isoname}.iso" ]; then
|
||||
echo "writing ${isoname}.iso to ${destpath} from ${srcpath}"
|
||||
_omb_util_print "writing ${isoname}.iso to ${destpath} from ${srcpath}"
|
||||
mkisofs -V "${isoname}" -iso-level 3 -r -o "${destpath}${isoname}.iso" "${srcpath}"
|
||||
else
|
||||
echo "${destpath}${isoname}.iso already exists"
|
||||
_omb_util_print "${destpath}${isoname}.iso already exists"
|
||||
fi
|
||||
else
|
||||
echo "mkisofs cmd does not exist, please install cdrtools"
|
||||
_omb_util_print "mkisofs cmd does not exist, please install cdrtools"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ function ips {
|
||||
then
|
||||
ip addr | grep -oP 'inet \K[\d.]+'
|
||||
else
|
||||
echo "You don't have ifconfig or ip command installed!"
|
||||
_omb_util_print "You don't have ifconfig or ip command installed!"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -218,24 +218,23 @@ function down4me {
|
||||
# -------------------------------------------------------------------
|
||||
function myip {
|
||||
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
||||
echo -e "Your public IP is: ${_omb_term_bold_green} $res ${_omb_term_normal}"
|
||||
_omb_util_print "Your public IP is: ${_omb_term_bold_green} $res ${_omb_term_normal}"
|
||||
}
|
||||
|
||||
# ii: display useful host related informaton
|
||||
# -------------------------------------------------------------------
|
||||
function ii {
|
||||
echo -e "\\nYou are logged on ${_omb_term_brown}$HOST"
|
||||
echo -e "\\nAdditionnal information:$NC " ; uname -a
|
||||
echo -e "\\n${_omb_term_brown}Users logged on:$NC " ; w -h
|
||||
echo -e "\\n${_omb_term_brown}Current date :$NC " ; date
|
||||
echo -e "\\n${_omb_term_brown}Machine stats :$NC " ; uptime
|
||||
[[ "$OSTYPE" == darwin* ]] && echo -e "\\n${_omb_term_brown}Current network location :$NC " ; scselect
|
||||
echo -e "\\n${_omb_term_brown}Public facing IP Address :$NC " ;myip
|
||||
[[ "$OSTYPE" == darwin* ]] && echo -e "\\n${_omb_term_brown}DNS Configuration:$NC " ; scutil --dns
|
||||
echo
|
||||
_omb_util_print $'\n'"You are logged on ${_omb_term_brown}$HOST"
|
||||
_omb_util_print $'\n'"Additionnal information:$NC "; uname -a
|
||||
_omb_util_print $'\n'"${_omb_term_brown}Users logged on:$NC "; w -h
|
||||
_omb_util_print $'\n'"${_omb_term_brown}Current date :$NC "; date
|
||||
_omb_util_print $'\n'"${_omb_term_brown}Machine stats :$NC "; uptime
|
||||
[[ "$OSTYPE" == darwin* ]] && _omb_util_print $'\n'"${_omb_term_brown}Current network location :$NC " ; scselect
|
||||
_omb_util_print $'\n'"${_omb_term_brown}Public facing IP Address :$NC " ;myip
|
||||
[[ "$OSTYPE" == darwin* ]] && _omb_util_print $'\n'"${_omb_term_brown}DNS Configuration:$NC " ; scutil --dns
|
||||
_omb_util_print
|
||||
}
|
||||
|
||||
|
||||
# ---------------------------------------
|
||||
# 6. SYSTEMS OPERATIONS & INFORMATION
|
||||
# ---------------------------------------
|
||||
@ -243,15 +242,15 @@ function ii {
|
||||
# batch_chmod: Batch chmod for all files & sub-directories in the current one
|
||||
# -------------------------------------------------------------------
|
||||
function batch_chmod {
|
||||
echo -ne "${_omb_term_bold_navy}Applying 0755 permission for all directories..."
|
||||
_omb_util_put "${_omb_term_bold_navy}Applying 0755 permission for all directories..."
|
||||
(find . -type d -print0 | xargs -0 chmod 0755) &
|
||||
spinner
|
||||
echo -ne "${_omb_term_normal}"
|
||||
_omb_util_put "${_omb_term_normal}"
|
||||
|
||||
echo -ne "${_omb_term_bold_navy}Applying 0644 permission for all files..."
|
||||
_omb_util_put "${_omb_term_bold_navy}Applying 0644 permission for all files..."
|
||||
(find . -type f -print0 | xargs -0 chmod 0644) &
|
||||
spinner
|
||||
echo -ne "${_omb_term_normal}"
|
||||
_omb_util_put "${_omb_term_normal}"
|
||||
}
|
||||
|
||||
# usage: disk usage per directory, in Mac OS X and Linux
|
||||
@ -292,9 +291,9 @@ function pickfrom {
|
||||
# shellcheck disable=SC2086
|
||||
function passgen {
|
||||
local i pass length=${1:-4}
|
||||
pass=$(echo $(for i in $(eval echo "{1..$length}"); do pickfrom /usr/share/dict/words; done))
|
||||
echo "With spaces (easier to memorize): $pass"
|
||||
echo "Without (use this as the password): $(echo $pass | tr -d ' ')"
|
||||
pass=$(_omb_util_print $(for ((i=1;i<=length;i++)); do pickfrom /usr/share/dict/words; done))
|
||||
_omb_util_print "With spaces (easier to memorize): $pass"
|
||||
_omb_util_print "Without (use this as the password): $(tr -d ' ' <<< "$pass")"
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ _omb_util_alias_delayed ls
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
if _omb_util_binary_exists notify-send; then
|
||||
_omb_util_alias alert='notify-send --urgency=low -i "$(if (($? == 0)); then echo terminal; else echo error; fi)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
_omb_util_alias alert='notify-send --urgency=low -i "$(if (($? == 0)); then _omb_util_print terminal; else _omb_util_print error; fi)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
fi
|
||||
|
||||
# Alias definitions.
|
||||
|
@ -25,7 +25,7 @@ function open_command() {
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) open_cmd='xdg-open' ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
*) _omb_util_print "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@ -51,12 +51,12 @@ function open_command() {
|
||||
#
|
||||
if ((_omb_bash_version >= 40000)); then
|
||||
function alias_value() {
|
||||
[[ ${BASH_ALIASES[$1]+set} ]] && echo "${BASH_ALIASES[$1]}"
|
||||
[[ ${BASH_ALIASES[$1]+set} ]] && _omb_util_print "${BASH_ALIASES[$1]}"
|
||||
}
|
||||
else
|
||||
function alias_value() {
|
||||
local value=
|
||||
value=$(alias "$1" 2>/dev/null) && eval "value=${value#*=}" && echo "$value"
|
||||
value=$(alias "$1" 2>/dev/null) && eval "value=${value#*=}" && _omb_util_print "$value"
|
||||
}
|
||||
fi
|
||||
|
||||
@ -72,7 +72,7 @@ fi
|
||||
# Always 0
|
||||
#
|
||||
function try_alias_value() {
|
||||
alias_value "$1" || echo "$1"
|
||||
alias_value "$1" || _omb_util_print "$1"
|
||||
}
|
||||
|
||||
#
|
||||
|
34
lib/git.sh
34
lib/git.sh
@ -15,7 +15,7 @@ _omb_deprecate_declare 20000 POST_1_7_2_GIT _omb_git_post_1_7_2 sync
|
||||
# if [[ $(_omb_prompt_git config --get oh-my-bash.hide-status 2>/dev/null) != 1 ]]; then
|
||||
# ref=$(_omb_prompt_git symbolic-ref HEAD 2> /dev/null) || \
|
||||
# ref=$(_omb_prompt_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"
|
||||
# _omb_util_print "$OSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$OSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
# fi
|
||||
# }
|
||||
|
||||
@ -33,9 +33,9 @@ function parse_git_dirty {
|
||||
STATUS=$(_omb_prompt_git status "${FLAGS[@]}" 2> /dev/null | tail -n1)
|
||||
fi
|
||||
if [[ $STATUS ]]; then
|
||||
echo "$OSH_THEME_GIT_PROMPT_DIRTY"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$OSH_THEME_GIT_PROMPT_CLEAN"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ function git_remote_status {
|
||||
git_remote_status=$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX
|
||||
fi
|
||||
|
||||
echo "$git_remote_status"
|
||||
_omb_util_print "$git_remote_status"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ function git_current_branch {
|
||||
[[ $ret == 128 ]] && return # no git repo.
|
||||
ref=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) || return
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
_omb_util_print ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ function git_commits_ahead {
|
||||
if _omb_prompt_git rev-parse --git-dir &>/dev/null; then
|
||||
local commits=$(_omb_prompt_git rev-list --count @{upstream}..HEAD)
|
||||
if ((commits != 0)); then
|
||||
echo "$OSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$OSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
_omb_util_print "$OSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$OSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -100,7 +100,7 @@ function git_commits_behind {
|
||||
if _omb_prompt_git rev-parse --git-dir &>/dev/null; then
|
||||
local commits=$(_omb_prompt_git rev-list --count HEAD..@{upstream})
|
||||
if ((commits != 0)); then
|
||||
echo "$OSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$OSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
_omb_util_print "$OSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$OSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -108,23 +108,23 @@ function git_commits_behind {
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead {
|
||||
if [[ $(_omb_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null) ]]; then
|
||||
echo "$OSH_THEME_GIT_PROMPT_AHEAD"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is behind remote
|
||||
function git_prompt_behind {
|
||||
if [[ $(_omb_prompt_git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null) ]]; then
|
||||
echo "$OSH_THEME_GIT_PROMPT_BEHIND"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch exists on remote or not
|
||||
function git_prompt_remote {
|
||||
if [[ $(_omb_prompt_git show-ref origin/$(git_current_branch) 2> /dev/null) ]]; then
|
||||
echo "$OSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||
else
|
||||
echo "$OSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -132,14 +132,14 @@ function git_prompt_remote {
|
||||
function git_prompt_short_sha {
|
||||
local SHA
|
||||
SHA=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) &&
|
||||
echo "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit long SHA
|
||||
function git_prompt_long_sha {
|
||||
local SHA
|
||||
SHA=$(_omb_prompt_git rev-parse HEAD 2> /dev/null) &&
|
||||
echo "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
_omb_util_print "$OSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$OSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
}
|
||||
|
||||
# Get the status of the working tree
|
||||
@ -176,7 +176,7 @@ function git_prompt_status {
|
||||
if command grep -q '^## [^ ]\+ .*diverged' <<< "$INDEX"; then
|
||||
STATUS=$OSH_THEME_GIT_PROMPT_DIVERGED$STATUS
|
||||
fi
|
||||
echo "$STATUS"
|
||||
_omb_util_print "$STATUS"
|
||||
}
|
||||
|
||||
# Compares the provided version of git to the version installed and on path
|
||||
@ -191,15 +191,15 @@ function git_compare_version {
|
||||
local i
|
||||
for i in {0..2}; do
|
||||
if ((INSTALLED_GIT_VERSION[i] > INPUT_GIT_VERSION[i])); then
|
||||
echo 1
|
||||
_omb_util_print 1
|
||||
return 0
|
||||
fi
|
||||
if ((INSTALLED_GIT_VERSION[i] < INPUT_GIT_VERSION[i])); then
|
||||
echo -1
|
||||
_omb_util_print -1
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo 0
|
||||
_omb_util_print 0
|
||||
}
|
||||
|
||||
# Outputs the name of the current user
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# is x grep argument available?
|
||||
function _omb_grep_flag_available {
|
||||
echo | grep "$1" "" >/dev/null 2>&1
|
||||
: | grep "$1" "" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
_omb_grep_options=()
|
||||
|
@ -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}"
|
||||
_omb_util_print "${OSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${OSH_THEME_NVM_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ function _omb_deprecate_warning {
|
||||
else
|
||||
func=
|
||||
fi
|
||||
printf '%s\n' "$src$sep$line$func$sep$_omb_term_reset $msg"
|
||||
_omb_util_print "$src$sep$line$func$sep$_omb_term_reset $msg"
|
||||
}
|
||||
|
||||
function _omb_deprecate_function__notify {
|
||||
@ -62,9 +62,9 @@ function _omb_deprecate_declare__init {
|
||||
__opts=$__opts:notified
|
||||
if ((_omb_version >= __ver)); then
|
||||
if [[ $__new ]]; then
|
||||
printf '%s\n' "oh-my-bash: The variable '$__old' is set but has been renamed to '$__new'. Please use '$__new'."
|
||||
_omb_util_print "oh-my-bash: The variable '$__old' is set but has been renamed to '$__new'. Please use '$__new'."
|
||||
else
|
||||
printf '%s\n' "oh-my-bash: The variable '$__old' is set but has been deprecated.${__msg+ $__msg}"
|
||||
_omb_util_print "oh-my-bash: The variable '$__old' is set but has been deprecated.${__msg+ $__msg}"
|
||||
fi >/dev/tty
|
||||
fi
|
||||
if [[ $__new && ! ${!__new+set} ]]; then
|
||||
@ -104,7 +104,7 @@ if ((_omb_bash_version >= 40300)); then
|
||||
_omb_deprecate_warning 1 "The variable '$esc_old' has been deprecated.${__msg+ $__msg}"
|
||||
fi >/dev/tty
|
||||
fi
|
||||
echo 1
|
||||
_omb_util_print 1
|
||||
}
|
||||
else
|
||||
_omb_deprecate_declare=()
|
||||
@ -152,9 +152,9 @@ else
|
||||
local esc_old=$_omb_term_bold_brown$__old$_omb_term_reset
|
||||
local esc_new=$_omb_term_bold_navy$__new$_omb_term_reset
|
||||
if [[ $__new ]]; then
|
||||
printf '%s\n' "oh-my-bash: The variable '$esc_old' is changed but has been renamed to '$esc_new'. Please use '$esc_new'."
|
||||
_omb_util_print "oh-my-bash: The variable '$esc_old' is changed but has been renamed to '$esc_new'. Please use '$esc_new'."
|
||||
else
|
||||
printf '%s\n' "oh-my-bash: The variable '$esc_old' is changed but has been deprecated.${__msg+ $__msg}"
|
||||
_omb_util_print "oh-my-bash: The variable '$esc_old' is changed but has been deprecated.${__msg+ $__msg}"
|
||||
fi >/dev/tty
|
||||
fi
|
||||
|
||||
@ -215,7 +215,7 @@ if ((_omb_bash_version >= 40300)); then
|
||||
_omb_deprecate_warning 1 "The variable '$esc_old' has been deprecated.${__msg+ $__msg}" >&2
|
||||
fi
|
||||
fi
|
||||
echo 1
|
||||
_omb_util_print 1
|
||||
}
|
||||
function _omb_deprecate_const__sync {
|
||||
local __index __old __curval __compaction=
|
||||
|
@ -185,7 +185,7 @@ function git_clean_branch {
|
||||
local stripped_ref=${unsafe_ref##refs/heads/}
|
||||
local clean_ref=${stripped_ref//[\$\`\\]/-}
|
||||
clean_ref=${clean_ref//[^[:print:]]/-} # strip escape sequences, etc.
|
||||
echo $clean_ref
|
||||
_omb_util_print $clean_ref
|
||||
}
|
||||
|
||||
function git_prompt_minimal_info {
|
||||
@ -360,7 +360,7 @@ function get_hg_root {
|
||||
|
||||
while [ "$CURRENT_DIR" != "/" ]; do
|
||||
if [ -d "$CURRENT_DIR/.hg" ]; then
|
||||
echo "$CURRENT_DIR/.hg"
|
||||
_omb_util_print "$CURRENT_DIR/.hg"
|
||||
return
|
||||
fi
|
||||
|
||||
@ -620,7 +620,7 @@ if ! _omb_util_command_exists 'battery_charge' ; then
|
||||
# if user has installed battery plugin, skip this...
|
||||
function battery_charge (){
|
||||
# no op
|
||||
echo -n
|
||||
_omb_util_put
|
||||
}
|
||||
fi
|
||||
|
||||
@ -629,15 +629,15 @@ fi
|
||||
if ! _omb_util_command_exists 'battery_percentage' ; then
|
||||
function battery_char (){
|
||||
# no op
|
||||
echo -n
|
||||
_omb_util_put
|
||||
}
|
||||
fi
|
||||
|
||||
function aws_profile {
|
||||
if [[ $AWS_DEFAULT_PROFILE ]]; then
|
||||
echo -e "${AWS_DEFAULT_PROFILE}"
|
||||
_omb_util_print "$AWS_DEFAULT_PROFILE"
|
||||
else
|
||||
echo -e "default"
|
||||
_omb_util_print "default"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,14 @@ function _omb_theme__construct_sgr {
|
||||
else
|
||||
color="8;5;$(((r * 36 + b * 6 + g) / 51 + 16))"
|
||||
fi ;;
|
||||
*) printf '%s\n' "_omb_theme_color: unknown color '$color'" >&2
|
||||
*) _omb_util_print "_omb_theme_color: unknown color '$color'" >&2
|
||||
continue ;;
|
||||
esac
|
||||
out=${out:+$out;}$prefix$color ;;
|
||||
'')
|
||||
out="${out:+$out;}$*" ;;
|
||||
*)
|
||||
printf '%s\n' "_omb_theme_color: unknown token '$next'" >&2 ;;
|
||||
_omb_util_print "_omb_theme_color: unknown token '$next'" >&2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -1,5 +1,18 @@
|
||||
#! bash oh-my-bash.module
|
||||
|
||||
function _omb_util_put {
|
||||
printf '%s' "$@"
|
||||
}
|
||||
|
||||
function _omb_util_print {
|
||||
local IFS=$' \t\n'
|
||||
printf '%s\n' "$*"
|
||||
}
|
||||
|
||||
function _omb_util_print_lines {
|
||||
printf '%s\n' "$@"
|
||||
}
|
||||
|
||||
function _omb_string_escape_prompt {
|
||||
REPLY=$1
|
||||
local specialchars='\`$'
|
||||
|
@ -8,6 +8,9 @@
|
||||
## print the real path of the filename which is possibly a symbolic link.
|
||||
##
|
||||
|
||||
# use _omb_util_print
|
||||
_omb_module_require lib:omb-util
|
||||
# use _omb_util_function_exists, _omb_util_binary_exists
|
||||
_omb_module_require lib:utils
|
||||
|
||||
if ((_omb_bash_version >= 40000)); then
|
||||
@ -73,7 +76,7 @@ function _omb_util_readlink__resolve_loop {
|
||||
fi
|
||||
while [[ $path == ?*/ ]]; do path=${path%/}; done
|
||||
done
|
||||
echo "$path"
|
||||
_omb_util_print "$path"
|
||||
}
|
||||
|
||||
function _omb_util_readlink__resolve {
|
||||
@ -105,6 +108,6 @@ function _omb_util_readlink {
|
||||
if [[ -h $1 ]]; then
|
||||
_omb_util_readlink__resolve "$1"
|
||||
else
|
||||
echo "$1"
|
||||
_omb_util_print "$1"
|
||||
fi
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ function _omb_util_setexit {
|
||||
}
|
||||
|
||||
function _omb_util_defun_print {
|
||||
builtin eval -- "function $1 { local $3; $2 \"\$@\" && printf '%s\n' \"\${$3}\"; }"
|
||||
builtin eval -- "function $1 { local $3; $2 \"\$@\" && _omb_util_print \"\${$3}\"; }"
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -69,7 +69,7 @@ function _omb_module_require {
|
||||
completion) locations=({"$OSH_CUSTOM","$OSH"}/completions/"$name".completion.{bash,sh}) ;;
|
||||
theme) locations=({"$OSH_CUSTOM"{,/themes},"$OSH"/themes}/"$name"/"$name".theme.{bash,sh}) ;;
|
||||
*)
|
||||
echo "oh-my-bash (module_require): unknown module type '$type'." >&2
|
||||
printf '%s\n' "oh-my-bash (module_require): unknown module type '$type'." >&2
|
||||
status=2
|
||||
continue ;;
|
||||
esac
|
||||
@ -83,7 +83,7 @@ function _omb_module_require {
|
||||
fi
|
||||
done
|
||||
|
||||
echo "oh-my-bash (module_require): module '$type:$name' not found." >&2
|
||||
printf '%s\n' "oh-my-bash (module_require): module '$type:$name' not found." >&2
|
||||
status=127
|
||||
done
|
||||
|
||||
@ -108,6 +108,7 @@ function _omb_module_require_theme { _omb_module_require "${@/#/theme:}"; }
|
||||
|
||||
# Load all of the config files in ~/.oh-my-bash/lib that end in .sh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
_omb_module_require_lib omb-util
|
||||
_omb_module_require_lib utils
|
||||
_omb_util_glob_expand _omb_init_files '{"$OSH","$OSH_CUSTOM"}/lib/*.{bash,sh}'
|
||||
_omb_init_files=("${_omb_init_files[@]##*/}")
|
||||
@ -162,7 +163,7 @@ if [[ $OSH_THEME == random ]]; then
|
||||
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..."
|
||||
printf '%s\n' "[oh-my-bash] Random theme '$OMB_THEME_RANDOM_SELECTED' ($_omb_init_file) loaded..."
|
||||
fi
|
||||
unset -v _omb_init_files _omb_init_file
|
||||
elif [[ $OSH_THEME ]]; then
|
||||
|
@ -6,12 +6,12 @@ function ansible-version(){
|
||||
|
||||
function ansible-role-init(){
|
||||
if ! [ -z $1] ; then
|
||||
echo "Ansible Role : $1 Creating...."
|
||||
_omb_util_print "Ansible Role : $1 Creating...."
|
||||
ansible-galaxy init $1
|
||||
tree $1
|
||||
else
|
||||
echo "Usage : ansible-role-init <role name>"
|
||||
echo "Example : ansible-role-init role1"
|
||||
_omb_util_print "Usage : ansible-role-init <role name>"
|
||||
_omb_util_print "Example : ansible-role-init role1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
export AWS_HOME=~/.aws
|
||||
|
||||
function agp {
|
||||
echo $AWS_DEFAULT_PROFILE
|
||||
_omb_util_print $AWS_DEFAULT_PROFILE
|
||||
}
|
||||
|
||||
function asp {
|
||||
|
@ -100,7 +100,7 @@ function bm {
|
||||
*)
|
||||
if [[ $1 == -* ]]; then
|
||||
# unrecognized option. echo error message and usage [ bm -X ]
|
||||
echo "Unknown option '$1'"
|
||||
_omb_util_print "Unknown option '$1'"
|
||||
_bashmarks_usage
|
||||
kill -SIGINT $$
|
||||
exit 1
|
||||
@ -117,21 +117,21 @@ function bm {
|
||||
|
||||
# print usage information
|
||||
function _bashmarks_usage {
|
||||
echo 'USAGE:'
|
||||
echo "bm -h - Prints this usage info"
|
||||
echo 'bm -a <bookmark_name> - Saves the current directory as "bookmark_name"'
|
||||
echo 'bm [-g] <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
|
||||
echo 'bm -p <bookmark_name> - Prints the directory associated with "bookmark_name"'
|
||||
echo 'bm -d <bookmark_name> - Deletes the bookmark'
|
||||
echo 'bm -l - Lists all available bookmarks'
|
||||
_omb_util_print 'USAGE:'
|
||||
_omb_util_print "bm -h - Prints this usage info"
|
||||
_omb_util_print 'bm -a <bookmark_name> - Saves the current directory as "bookmark_name"'
|
||||
_omb_util_print 'bm [-g] <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
|
||||
_omb_util_print 'bm -p <bookmark_name> - Prints the directory associated with "bookmark_name"'
|
||||
_omb_util_print 'bm -d <bookmark_name> - Deletes the bookmark'
|
||||
_omb_util_print 'bm -l - Lists all available bookmarks'
|
||||
}
|
||||
|
||||
# save current directory to bookmarks
|
||||
function _bashmarks_save {
|
||||
if _bashmarks_is_valid_bookmark_name "$@"; then
|
||||
_bashmarks_purge_line "$BASHMARKS_SDIRS" "export DIR_$1="
|
||||
CURDIR=$(echo $PWD| sed "s#^$HOME#\$HOME#g")
|
||||
echo "export DIR_$1=\"$CURDIR\"" >> "$BASHMARKS_SDIRS"
|
||||
CURDIR=$(sed "s#^$HOME#\$HOME#g" <<< "$PWD")
|
||||
_omb_util_print "export DIR_$1=\"$CURDIR\"" >> "$BASHMARKS_SDIRS"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -151,9 +151,9 @@ function _bashmarks_goto {
|
||||
if [[ -d $target ]]; then
|
||||
cd "$target"
|
||||
elif [[ ! $target ]]; then
|
||||
printf '%s\n' "${_omb_term_brown}WARNING: '${1}' bashmark does not exist${_omb_term_reset}"
|
||||
_omb_util_print "${_omb_term_brown}WARNING: '${1}' bashmark does not exist${_omb_term_reset}"
|
||||
else
|
||||
printf '%s\n' "${_omb_term_brown}WARNING: '${target}' does not exist${_omb_term_reset}"
|
||||
_omb_util_print "${_omb_term_brown}WARNING: '${target}' does not exist${_omb_term_reset}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -184,11 +184,11 @@ function _bashmarks_is_valid_bookmark_name {
|
||||
local exit_message=""
|
||||
if [[ ! $1 ]]; then
|
||||
exit_message="bookmark name required"
|
||||
echo "$exit_message" >&2
|
||||
_omb_util_print "$exit_message" >&2
|
||||
return 1
|
||||
elif [[ $1 == *[!A-Za-z0-9_]* ]]; then
|
||||
exit_message="bookmark name is not valid"
|
||||
echo "$exit_message" >&2
|
||||
_omb_util_print "$exit_message" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -49,65 +49,65 @@ function battery_percentage {
|
||||
if _omb_util_command_exists upower; then
|
||||
local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | sed -n 's/.*percentage[:[:blank:]]*\([0-9%]\{1,\}\)$/\1/p')
|
||||
[[ $UPOWER_OUTPUT ]] &&
|
||||
echo "${UPOWER_OUTPUT::-1}"
|
||||
_omb_util_print "${UPOWER_OUTPUT::-1}"
|
||||
elif _omb_util_command_exists acpi; then
|
||||
local ACPI_OUTPUT=$(acpi -b)
|
||||
case $ACPI_OUTPUT in
|
||||
*" Unknown"*)
|
||||
local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 22 | tail -c 2)
|
||||
local PERC_OUTPUT=$(head -c 22 <<< "$ACPI_OUTPUT" | tail -c 2)
|
||||
case $PERC_OUTPUT in
|
||||
*%)
|
||||
echo "0${PERC_OUTPUT}" | head -c 2
|
||||
head -c 2 <<< "0${PERC_OUTPUT}"
|
||||
;;
|
||||
*)
|
||||
echo ${PERC_OUTPUT}
|
||||
_omb_util_print ${PERC_OUTPUT}
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*" Charging"* | *" Discharging"*)
|
||||
local PERC_OUTPUT=$(echo $ACPI_OUTPUT | awk -F, '/,/{gsub(/ /, "", $0); gsub(/%/,"", $0); print $2}' )
|
||||
echo ${PERC_OUTPUT}
|
||||
local PERC_OUTPUT=$(awk -F, '/,/{gsub(/ /, "", $0); gsub(/%/,"", $0); print $2}' <<< "$ACPI_OUTPUT")
|
||||
_omb_util_print ${PERC_OUTPUT}
|
||||
;;
|
||||
*" Full"*)
|
||||
echo '100'
|
||||
_omb_util_print '100'
|
||||
;;
|
||||
*)
|
||||
echo '-1'
|
||||
_omb_util_print '-1'
|
||||
;;
|
||||
esac
|
||||
elif _omb_util_command_exists pmset; then
|
||||
local PMSET_OUTPUT=$(pmset -g ps | sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p')
|
||||
case $PMSET_OUTPUT in
|
||||
100*)
|
||||
echo '100'
|
||||
_omb_util_print '100'
|
||||
;;
|
||||
*)
|
||||
echo $PMSET_OUTPUT | head -c 2
|
||||
head -c 2 <<< "$PMSET_OUTPUT"
|
||||
;;
|
||||
esac
|
||||
elif _omb_util_command_exists ioreg; then
|
||||
local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%05.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
|
||||
case $IOREG_OUTPUT in
|
||||
100*)
|
||||
echo '100'
|
||||
_omb_util_print '100'
|
||||
;;
|
||||
*)
|
||||
echo $IOREG_OUTPUT | head -c 2
|
||||
head -c 2 <<< "$IOREG_OUTPUT"
|
||||
;;
|
||||
esac
|
||||
elif _omb_util_command_exists WMIC; then
|
||||
local WINPC=$(echo porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List) | grep -o '[0-9]*')
|
||||
local WINPC=$(grep -o '[0-9]*' <<< "porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List)")
|
||||
case $WINPC in
|
||||
100*)
|
||||
echo '100'
|
||||
_omb_util_print '100'
|
||||
;;
|
||||
*)
|
||||
echo $WINPC
|
||||
_omb_util_print $WINPC
|
||||
;;
|
||||
esac
|
||||
elif [[ -r /sys/class/power_supply/BAT0/capacity ]]; then
|
||||
echo "$(< /sys/class/power_supply/BAT0/capacity)"
|
||||
_omb_util_print "$(< /sys/class/power_supply/BAT0/capacity)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -128,52 +128,52 @@ function battery_charge {
|
||||
|
||||
case $BATTERY_PERC in
|
||||
no)
|
||||
echo ""
|
||||
_omb_util_print ""
|
||||
;;
|
||||
9*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
8*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
7*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
6*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
5*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
4*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
3*)
|
||||
echo "${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
2*)
|
||||
echo "${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
1*)
|
||||
echo "${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
05)
|
||||
echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
04)
|
||||
echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
03)
|
||||
echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
02)
|
||||
echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
0*)
|
||||
echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
_omb_util_print "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${_omb_prompt_normal}"
|
||||
;;
|
||||
*)
|
||||
echo "${DANGER_COLOR}UNPLG${_omb_prompt_normal}"
|
||||
_omb_util_print "${DANGER_COLOR}UNPLG${_omb_prompt_normal}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ function current_repository() {
|
||||
if ! $_omb_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
echo $($_omb_git_git_cmd remote -v | cut -d':' -f 2)
|
||||
_omb_util_print $($_omb_git_git_cmd remote -v | cut -d':' -f 2)
|
||||
}
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
|
||||
echo "WIP!!"
|
||||
_omb_util_print "WIP!!"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -30,11 +30,11 @@ function git_develop_branch() {
|
||||
local branch
|
||||
for branch in dev devel development; do
|
||||
if command git show-ref -q --verify refs/heads/"$branch"; then
|
||||
echo "$branch"
|
||||
_omb_util_print "$branch"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo develop
|
||||
_omb_util_print develop
|
||||
}
|
||||
|
||||
# Check if main exists and use instead of master
|
||||
@ -43,11 +43,11 @@ function git_main_branch() {
|
||||
local ref
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
|
||||
if command git show-ref -q --verify "$ref"; then
|
||||
echo "${ref##*/}"
|
||||
_omb_util_print "${ref##*/}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo master
|
||||
_omb_util_print master
|
||||
}
|
||||
|
||||
#
|
||||
@ -306,7 +306,7 @@ alias grhh='command git reset --hard'
|
||||
alias grhk='command git reset --keep'
|
||||
alias grhs='command git reset --soft'
|
||||
alias groh='command git reset "origin/$(git_current_branch)" --hard'
|
||||
alias grt='cd $(command git rev-parse --show-toplevel || echo ".")'
|
||||
alias grt='cd $(command git rev-parse --show-toplevel || _omb_util_print ".")'
|
||||
alias gru='command git reset --'
|
||||
|
||||
alias grs='command git restore'
|
||||
|
@ -50,7 +50,7 @@ if _omb_util_command_exists nvm && [[ ${OMB_PLUGIN_NVM_AUTO_USE-} == true ]]; th
|
||||
while [[ $path && ! -e $path/$1 ]]; do
|
||||
path=${path%/*}
|
||||
done
|
||||
echo "$path"
|
||||
_omb_util_print "$path"
|
||||
}
|
||||
|
||||
function _omb_plugin_nvm_cd {
|
||||
|
@ -35,26 +35,26 @@ function progress()
|
||||
PARAM_PROGRESS=$1;
|
||||
PARAM_STATUS=$2;
|
||||
|
||||
if [ $CURRENT_PROGRESS -le 0 -a $PARAM_PROGRESS -ge 0 ] ; then echo -ne "[..........................] (0%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 5 -a $PARAM_PROGRESS -ge 5 ] ; then echo -ne "[#.........................] (5%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 10 -a $PARAM_PROGRESS -ge 10 ]; then echo -ne "[##........................] (10%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 15 -a $PARAM_PROGRESS -ge 15 ]; then echo -ne "[###.......................] (15%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 20 -a $PARAM_PROGRESS -ge 20 ]; then echo -ne "[####......................] (20%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 25 -a $PARAM_PROGRESS -ge 25 ]; then echo -ne "[#####.....................] (25%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 30 -a $PARAM_PROGRESS -ge 30 ]; then echo -ne "[######....................] (30%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 35 -a $PARAM_PROGRESS -ge 35 ]; then echo -ne "[#######...................] (35%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 40 -a $PARAM_PROGRESS -ge 40 ]; then echo -ne "[########..................] (40%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 45 -a $PARAM_PROGRESS -ge 45 ]; then echo -ne "[#########.................] (45%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 50 -a $PARAM_PROGRESS -ge 50 ]; then echo -ne "[##########................] (50%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 55 -a $PARAM_PROGRESS -ge 55 ]; then echo -ne "[###########...............] (55%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 60 -a $PARAM_PROGRESS -ge 60 ]; then echo -ne "[############..............] (60%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 65 -a $PARAM_PROGRESS -ge 65 ]; then echo -ne "[#############.............] (65%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 70 -a $PARAM_PROGRESS -ge 70 ]; then echo -ne "[###############...........] (70%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 75 -a $PARAM_PROGRESS -ge 75 ]; then echo -ne "[#################.........] (75%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 80 -a $PARAM_PROGRESS -ge 80 ]; then echo -ne "[####################......] (80%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 85 -a $PARAM_PROGRESS -ge 85 ]; then echo -ne "[#######################...] (90%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 90 -a $PARAM_PROGRESS -ge 90 ]; then echo -ne "[##########################] (100%) $PARAM_PHASE \r" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 100 -a $PARAM_PROGRESS -ge 100 ];then echo -ne 'Done! \n' ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 0 -a $PARAM_PROGRESS -ge 0 ] ; then printf "[..........................] (0%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 5 -a $PARAM_PROGRESS -ge 5 ] ; then printf "[#.........................] (5%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 10 -a $PARAM_PROGRESS -ge 10 ]; then printf "[##........................] (10%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 15 -a $PARAM_PROGRESS -ge 15 ]; then printf "[###.......................] (15%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 20 -a $PARAM_PROGRESS -ge 20 ]; then printf "[####......................] (20%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 25 -a $PARAM_PROGRESS -ge 25 ]; then printf "[#####.....................] (25%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 30 -a $PARAM_PROGRESS -ge 30 ]; then printf "[######....................] (30%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 35 -a $PARAM_PROGRESS -ge 35 ]; then printf "[#######...................] (35%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 40 -a $PARAM_PROGRESS -ge 40 ]; then printf "[########..................] (40%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 45 -a $PARAM_PROGRESS -ge 45 ]; then printf "[#########.................] (45%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 50 -a $PARAM_PROGRESS -ge 50 ]; then printf "[##########................] (50%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 55 -a $PARAM_PROGRESS -ge 55 ]; then printf "[###########...............] (55%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 60 -a $PARAM_PROGRESS -ge 60 ]; then printf "[############..............] (60%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 65 -a $PARAM_PROGRESS -ge 65 ]; then printf "[#############.............] (65%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 70 -a $PARAM_PROGRESS -ge 70 ]; then printf "[###############...........] (70%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 75 -a $PARAM_PROGRESS -ge 75 ]; then printf "[#################.........] (75%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 80 -a $PARAM_PROGRESS -ge 80 ]; then printf "[####################......] (80%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 85 -a $PARAM_PROGRESS -ge 85 ]; then printf "[#######################...] (90%) %s \r" "$PARAM_PHASE" ; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 90 -a $PARAM_PROGRESS -ge 90 ]; then printf "[##########################] (100%) %s \r" "$PARAM_PHASE"; delay; fi;
|
||||
if [ $CURRENT_PROGRESS -le 100 -a $PARAM_PROGRESS -ge 100 ];then printf 'Done! \n' ; delay; fi;
|
||||
|
||||
CURRENT_PROGRESS=$PARAM_PROGRESS;
|
||||
}
|
||||
|
@ -8,21 +8,21 @@ function vagrant-version() {
|
||||
|
||||
function vagrant-init() {
|
||||
if [[ $1 ]]; then
|
||||
echo "Vagrant init for : $1 Creating...."
|
||||
_omb_util_print "Vagrant init for : $1 Creating...."
|
||||
vagrant init -m "$1"
|
||||
else
|
||||
echo "Usage : vai <box name>" >&2
|
||||
echo "Example : vai centos/7" >&2
|
||||
_omb_util_print "Usage : vai <box name>" >&2
|
||||
_omb_util_print "Example : vai centos/7" >&2
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
function vagrant-up() {
|
||||
if [[ $1 ]]; then
|
||||
echo "Vagrant up for provider : $1 Running...."
|
||||
_omb_util_print "Vagrant up for provider : $1 Running...."
|
||||
vagrant up --provider "$1"
|
||||
else
|
||||
echo "Vagrant up for provider : virtualbox Running...."
|
||||
_omb_util_print "Vagrant up for provider : virtualbox Running...."
|
||||
vagrant up
|
||||
fi
|
||||
}
|
||||
@ -30,16 +30,16 @@ function vagrant-up() {
|
||||
function vagrant-plugin-vm() {
|
||||
case "$1" in
|
||||
"virtualbox")
|
||||
echo "Vagrant plugin install for provider : $1 Running...."
|
||||
_omb_util_print "Vagrant plugin install for provider : $1 Running...."
|
||||
vagrant plugin install vagrant-vbguest
|
||||
;;
|
||||
"libvirt")
|
||||
echo "Vagrant plugin install for provider : $1 Running...."
|
||||
_omb_util_print "Vagrant plugin install for provider : $1 Running...."
|
||||
vagrant plugin install vagrant-libvirt
|
||||
;;
|
||||
*)
|
||||
echo "Usage : vapvm <provider name>" >&2
|
||||
echo "Example : vapvm virtualbox" >&2
|
||||
_omb_util_print "Usage : vapvm <provider name>" >&2
|
||||
_omb_util_print "Example : vapvm virtualbox" >&2
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
@ -61,20 +61,20 @@ function vagrant-ssh() {
|
||||
|
||||
if ((VMDEFAULT == 1)); then
|
||||
if [[ $1 ]]; then
|
||||
echo "SKIP : $1 Server...."
|
||||
_omb_util_print "SKIP : $1 Server...."
|
||||
fi
|
||||
echo "Login to : default Server...."
|
||||
_omb_util_print "Login to : default Server...."
|
||||
vagrant ssh
|
||||
elif [[ $1 ]] && ((VMCOUNT > 1)); then
|
||||
echo "Login to : $1 Server...."
|
||||
_omb_util_print "Login to : $1 Server...."
|
||||
vagrant ssh "$1"
|
||||
elif ((VMCOUNT == 0)); then
|
||||
echo "Seems like that not there running servers" >&2
|
||||
_omb_util_print "Seems like that not there running servers" >&2
|
||||
return 1
|
||||
else
|
||||
echo -e "Please choose a server from this list:\\n"
|
||||
_omb_util_put $'Please choose a server from this list:\n\n'
|
||||
vagrant status | awk '/running/{print $1}'
|
||||
echo -e "\\nThen fill: vagrant ssh [ option ]"
|
||||
_omb_util_put $'\nThen fill: vagrant ssh [ option ]\n'
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ function _omb_plugin_xterm_short_dirname {
|
||||
if [[ ${OMB_PLUGIN_XTERM_SHORT_TERM_LINE-} == true ]] && ((${#dir_name} > 8)); then
|
||||
dir_name=${dir_name##*/}
|
||||
fi
|
||||
echo "$dir_name"
|
||||
_omb_util_print "$dir_name"
|
||||
}
|
||||
|
||||
function _omb_plugin_xterm_short_command {
|
||||
@ -23,7 +23,7 @@ function _omb_plugin_xterm_short_command {
|
||||
if [[ ${OMB_PLUGIN_XTERM_SHORT_TERM_LINE-} == true ]] && ((${#input_command} > 8)); then
|
||||
input_command=${input_command%% *}
|
||||
fi
|
||||
echo "$input_command"
|
||||
_omb_util_print "$input_command"
|
||||
}
|
||||
|
||||
function _omb_plugin_xterm_set_title {
|
||||
|
@ -11,7 +11,7 @@ fi
|
||||
function show_reboot_required() {
|
||||
if [ ! -z "$_bf_prompt_reboot_info" ]; then
|
||||
if [ -f /var/run/reboot-required ]; then
|
||||
printf "Reboot required!"
|
||||
_omb_util_put "Reboot required!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -20,9 +20,9 @@ function show_reboot_required() {
|
||||
function set_host_color() {
|
||||
# Detect if connection is through SSH
|
||||
if [[ ! -z $SSH_CLIENT ]]; then
|
||||
printf "${lime_yellow}"
|
||||
_omb_util_put "${lime_yellow}"
|
||||
else
|
||||
printf "${light_orange}"
|
||||
_omb_util_put "${light_orange}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -30,10 +30,10 @@ function set_host_color() {
|
||||
function set_user_color() {
|
||||
case $(id -u) in
|
||||
0)
|
||||
printf "${_omb_prompt_brown}"
|
||||
_omb_util_put "${_omb_prompt_brown}"
|
||||
;;
|
||||
*)
|
||||
printf "${_omb_prompt_teal}"
|
||||
_omb_util_put "${_omb_prompt_teal}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@ -44,7 +44,7 @@ function scm_prompt {
|
||||
then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ function set_custom_colors() {
|
||||
}
|
||||
|
||||
function __ps_time {
|
||||
echo "$(clock_prompt)${_omb_prompt_normal}\n"
|
||||
_omb_util_print "$(clock_prompt)${_omb_prompt_normal}\n"
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
|
@ -14,10 +14,10 @@ RVM_THEME_PROMPT_PREFIX="|"
|
||||
RVM_THEME_PROMPT_SUFFIX="|"
|
||||
|
||||
function __bobby_clock {
|
||||
printf "$(clock_prompt) "
|
||||
_omb_util_put "$(clock_prompt) "
|
||||
|
||||
if [ "${THEME_SHOW_CLOCK_CHAR}" == "true" ]; then
|
||||
printf "$(clock_char) "
|
||||
_omb_util_put "$(clock_char) "
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ SCM_HG_CHAR="${_omb_prompt_bold_brown}☿${_omb_prompt_normal}"
|
||||
function is_vim_shell {
|
||||
if [ ! -z "$VIMRUNTIME" ]
|
||||
then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ function scm_prompt {
|
||||
then
|
||||
return
|
||||
else
|
||||
echo " $(scm_char) (${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal})"
|
||||
_omb_util_print " $(scm_char) (${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal})"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ GIT_SHA_PREFIX="${_omb_prompt_navy}"
|
||||
GIT_SHA_SUFFIX="${_omb_prompt_reset_color}"
|
||||
|
||||
function git_short_sha() {
|
||||
SHA=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
|
||||
SHA=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) && _omb_util_print "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
|
@ -63,8 +63,13 @@ function winname {
|
||||
|
||||
# Displays the current prompt
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_normal}\$([[ -n \$(_omb_prompt_git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}"
|
||||
PS2="${icon_end}"
|
||||
PS1='\n'$icon_start$(_omb_prompt_print_python_venv)
|
||||
PS1+=$icon_user$_omb_prompt_bold_brown'\u'
|
||||
PS1+=$_omb_prompt_normal$icon_host$_omb_prompt_bold_teal'\h'
|
||||
PS1+=$_omb_prompt_normal$icon_directory$_omb_prompt_bold_purple'\W'
|
||||
PS1+=$_omb_prompt_normal$([[ -n $(_omb_prompt_git branch 2> /dev/null) ]] && _omb_util_print " on $icon_branch ")
|
||||
PS1+=$_omb_prompt_white$(scm_prompt_info)$_omb_prompt_normal'\n'$icon_end
|
||||
PS2=$icon_end
|
||||
}
|
||||
|
||||
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
|
||||
|
@ -58,7 +58,7 @@ esac
|
||||
function is_vim_shell {
|
||||
if [ ! -z "$VIMRUNTIME" ];
|
||||
then
|
||||
echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\
|
||||
_omb_util_print "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\
|
||||
vim shell${D_DEFAULT_COLOR} "
|
||||
fi
|
||||
}
|
||||
@ -67,7 +67,7 @@ function mitsuhikos_lastcommandfailed {
|
||||
code=$?
|
||||
if [ $code != 0 ];
|
||||
then
|
||||
echo "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}\
|
||||
_omb_util_print "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}\
|
||||
$code ${D_DEFAULT_COLOR}"
|
||||
fi
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ function doubletime_scm_prompt {
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]; then
|
||||
return
|
||||
elif [ $CHAR = $SCM_GIT_CHAR ]; then
|
||||
echo "$(git_prompt_status)"
|
||||
_omb_util_print "$(git_prompt_status)"
|
||||
else
|
||||
echo "[$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -56,17 +56,17 @@ _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|
||||
function git_prompt_status {
|
||||
local git_status_output
|
||||
git_status_output=$(_omb_prompt_git status 2> /dev/null )
|
||||
if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then
|
||||
if [ -n "$(grep 'Changes not staged' <<< "$git_status_output")" ]; then
|
||||
git_status="${_omb_prompt_bold_brown}$(scm_prompt_info) ✗"
|
||||
elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then
|
||||
elif [ -n "$(grep 'Changes to be committed' <<< "$git_status_output")" ]; then
|
||||
git_status="${_omb_prompt_bold_olive}$(scm_prompt_info) ^"
|
||||
elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then
|
||||
elif [ -n "$(grep 'Untracked files' <<< "$git_status_output")" ]; then
|
||||
git_status="${_omb_prompt_bold_teal}$(scm_prompt_info) +"
|
||||
elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then
|
||||
elif [ -n "$(grep 'nothing to commit' <<< "$git_status_output")" ]; then
|
||||
git_status="${_omb_prompt_bold_green}$(scm_prompt_info) ${_omb_prompt_green}✓"
|
||||
else
|
||||
git_status="$(scm_prompt_info)"
|
||||
fi
|
||||
echo "[$git_status${_omb_prompt_normal}]"
|
||||
_omb_util_print "[$git_status${_omb_prompt_normal}]"
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ function venv {
|
||||
if [ -n "$VIRTUAL_ENV" ]
|
||||
then
|
||||
local env=$VIRTUAL_ENV
|
||||
echo "${gray} in ${_omb_prompt_red}${env##*/} "
|
||||
_omb_util_print "${gray} in ${_omb_prompt_red}${env##*/} "
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ function get_hour_color {
|
||||
else
|
||||
hour_color=$_omb_prompt_brown
|
||||
fi
|
||||
echo "$hour_color"
|
||||
_omb_util_print "$hour_color"
|
||||
}
|
||||
|
||||
function __emperor_clock {
|
||||
|
@ -20,7 +20,7 @@ function scm_prompt {
|
||||
then
|
||||
return
|
||||
else
|
||||
echo "$(scm_prompt_info) "
|
||||
_omb_util_print "$(scm_prompt_info) "
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -18,28 +18,28 @@ SCM_NONE_CHAR=""
|
||||
function _omb_theme_ht_exit_color {
|
||||
case $1 in
|
||||
0)
|
||||
echo "$_omb_prompt_green"
|
||||
_omb_util_print "$_omb_prompt_green"
|
||||
;;
|
||||
1)
|
||||
echo "$_omb_prompt_red"
|
||||
_omb_util_print "$_omb_prompt_red"
|
||||
;;
|
||||
2)
|
||||
echo "$_omb_prompt_gray"
|
||||
_omb_util_print "$_omb_prompt_gray"
|
||||
;;
|
||||
126)
|
||||
echo "$_omb_prompt_cyan"
|
||||
_omb_util_print "$_omb_prompt_cyan"
|
||||
;;
|
||||
127)
|
||||
echo "$_omb_prompt_magenta"
|
||||
_omb_util_print "$_omb_prompt_magenta"
|
||||
;;
|
||||
130)
|
||||
echo "$_omb_prompt_black"
|
||||
_omb_util_print "$_omb_prompt_black"
|
||||
;;
|
||||
148)
|
||||
echo "$_omb_prompt_yellow"
|
||||
_omb_util_print "$_omb_prompt_yellow"
|
||||
;;
|
||||
*)
|
||||
echo "$_omb_prompt_blue"
|
||||
_omb_util_print "$_omb_prompt_blue"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -62,8 +62,13 @@ function winname {
|
||||
|
||||
# Displays the current prompt
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
PS1="${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\w${_omb_prompt_normal}\$([[ -n \$(_omb_prompt_git branch 2> /dev/null) ]] && echo \" on (${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}"
|
||||
PS2="${icon_end}"
|
||||
PS1=$icon_start$(_omb_prompt_print_python_venv)
|
||||
PS1+=$icon_user$_omb_prompt_bold_brown'\u'
|
||||
PS1+=$_omb_prompt_normal$icon_host$_omb_prompt_bold_teal'\h'
|
||||
PS1+=$_omb_prompt_normal$icon_directory$_omb_prompt_bold_purple'\w'
|
||||
PS1+=$_omb_prompt_normal$([[ -n $(_omb_prompt_git branch 2> /dev/null) ]] && _omb_util_print " on (${icon_branch} ")
|
||||
PS1+=$_omb_prompt_white$(scm_prompt_info)$_omb_prompt_normal'\n'$icon_end
|
||||
PS2=$icon_end
|
||||
}
|
||||
|
||||
# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
|
||||
|
@ -60,12 +60,12 @@ function __my_rvm_ruby_version {
|
||||
[[ $gemset ]] && gemset=@$gemset
|
||||
local version=$(awk -F'-' '{print $2}' <<< "$MY_RUBY_HOME")
|
||||
local full=$version$gemset
|
||||
[[ $full ]] && echo "[$full]"
|
||||
[[ $full ]] && _omb_util_print "[$full]"
|
||||
}
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR == "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$GREEN$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)][$GREEN$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ function modern_scm_prompt {
|
||||
function chroot {
|
||||
if [[ $debian_chroot ]]; then
|
||||
local my_ps_chroot=$_omb_prompt_bold_teal$debian_chroot$_omb_prompt_normal
|
||||
echo "($my_ps_chroot)"
|
||||
_omb_util_print "($my_ps_chroot)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -91,9 +91,9 @@ function my_ve {
|
||||
if [[ $VIRTUAL_ENV ]]; then
|
||||
local ve=$(basename "$VIRTUAL_ENV")
|
||||
local my_ps_ve=$_omb_prompt_bold_purple$ve$_omb_prompt_normal
|
||||
echo "($my_ps_ve)"
|
||||
_omb_util_print "($my_ps_ve)"
|
||||
fi
|
||||
echo ""
|
||||
_omb_util_print ""
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND {
|
||||
|
@ -14,7 +14,8 @@ GIT_SHA_PREFIX=" ${_omb_prompt_olive}"
|
||||
GIT_SHA_SUFFIX="${_omb_prompt_reset_color}"
|
||||
|
||||
function git_short_sha() {
|
||||
SHA=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
|
||||
SHA=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) &&
|
||||
_omb_util_print "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
|
@ -21,7 +21,7 @@ PS3=">> "
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR == "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)][$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -54,5 +54,5 @@ PS2="└─▪ "
|
||||
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|
||||
|
||||
if [[ -t 2 ]] && ! _omb_util_binary_exists t; then
|
||||
printf '%s\n' "${_omb_term_bold_navy}oh-my-bash (theme:modern-t)${_omb_term_normal}: command \"t\" not found. The theme \"Modern T\" depends on a todo-list manager \"t\" (${_omb_term_underline}https://github.com/sjl/t${_omb_term_normal})." >&2
|
||||
_omb_util_print "${_omb_term_bold_navy}oh-my-bash (theme:modern-t)${_omb_term_normal}: command \"t\" not found. The theme \"Modern T\" depends on a todo-list manager \"t\" (${_omb_term_underline}https://github.com/sjl/t${_omb_term_normal})." >&2
|
||||
fi
|
||||
|
@ -21,7 +21,7 @@ PS3=">> "
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR == "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)][$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ function randomize_nwinkler {
|
||||
THEME_CLOCK_COLOR=$TIME_COLOR
|
||||
PATH_COLOR=${AVAILABLE_COLORS[$RANDOM % ${#AVAILABLE_COLORS[@]} ]}
|
||||
|
||||
echo "$USERNAME_COLOR,$HOSTNAME_COLOR,$TIME_COLOR,$PATH_COLOR," > $RANDOM_COLOR_FILE
|
||||
_omb_util_print "$USERNAME_COLOR,$HOSTNAME_COLOR,$TIME_COLOR,$PATH_COLOR," > $RANDOM_COLOR_FILE
|
||||
}
|
||||
|
||||
if [ -f $RANDOM_COLOR_FILE ];
|
||||
@ -74,13 +74,13 @@ else
|
||||
# No colors stored yet. Generate them!
|
||||
randomize_nwinkler
|
||||
|
||||
echo
|
||||
echo "Looks like you are using the nwinkler_random_color bashit theme for the first time."
|
||||
echo "Random colors have been generated to be used in your prompt."
|
||||
echo "If you don't like them, run the command:"
|
||||
echo " randomize_nwinkler"
|
||||
echo "until you get a combination that you like."
|
||||
echo
|
||||
_omb_util_print
|
||||
_omb_util_print "Looks like you are using the nwinkler_random_color bashit theme for the first time."
|
||||
_omb_util_print "Random colors have been generated to be used in your prompt."
|
||||
_omb_util_print "If you don't like them, run the command:"
|
||||
_omb_util_print " randomize_nwinkler"
|
||||
_omb_util_print "until you get a combination that you like."
|
||||
_omb_util_print
|
||||
fi
|
||||
|
||||
PROMPT_END_CLEAN="${_omb_prompt_green}→${_omb_prompt_reset_color}"
|
||||
|
@ -13,7 +13,7 @@ function __pb10k_remove_empty_elements {
|
||||
trimmed=${trimmed%"${trimmed##*[![:space:]]}"}
|
||||
[[ $trimmed ]] && new_array+=("$element")
|
||||
done
|
||||
echo "${new_array[@]}"
|
||||
_omb_util_print "${new_array[*]}"
|
||||
}
|
||||
|
||||
function __pb10k_format_duration {
|
||||
@ -23,11 +23,11 @@ function __pb10k_format_duration {
|
||||
local hours=$((duration / 3600))
|
||||
|
||||
if ((hours > 0)); then
|
||||
echo "${hours}h ${minutes}m ${seconds}s"
|
||||
_omb_util_print "${hours}h ${minutes}m ${seconds}s"
|
||||
elif ((minutes > 0)); then
|
||||
echo "${minutes}m ${seconds}s"
|
||||
_omb_util_print "${minutes}m ${seconds}s"
|
||||
else
|
||||
echo "${seconds}s"
|
||||
_omb_util_print "${seconds}s"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -152,8 +152,8 @@ function __pb10k_prompt_scm {
|
||||
local color=$_omb_prompt_bold_green
|
||||
scm
|
||||
local box=""
|
||||
local info="$(if [ "$SCM" == "git" ]; then echo " "; fi)"
|
||||
info+="$(if [ "$SCM" != "NONE" ]; then echo " $(scm_prompt_info)"; fi)"
|
||||
local info="$(if [ "$SCM" == "git" ]; then _omb_util_print " "; fi)"
|
||||
info+="$(if [ "$SCM" != "NONE" ]; then _omb_util_print " $(scm_prompt_info)"; fi)"
|
||||
[[ $info ]] || return 0
|
||||
printf "%s|%s|%s|%s" "$color" "$info" "$_omb_prompt_bold_green" "$box"
|
||||
}
|
||||
@ -227,9 +227,9 @@ function __pb10k_prompt_exitcode {
|
||||
function __pb10k_prompt_char {
|
||||
local color=$(
|
||||
if ((exitcode != 0)); then
|
||||
echo "$_omb_prompt_bold_red"
|
||||
_omb_util_print "$_omb_prompt_bold_red"
|
||||
else
|
||||
echo "$_omb_prompt_bold_green"
|
||||
_omb_util_print "$_omb_prompt_bold_green"
|
||||
fi
|
||||
)
|
||||
printf "%s|%s" "$color" "$__PB10K_PROMPT_CHAR_PS1"
|
||||
|
@ -32,17 +32,17 @@ function __powerline_user_info_prompt {
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[[ -n "${user_info}" ]] && echo "$OMB_THEME_POWERLINE_ICON_USER ${user_info} `date +%X\ %D`|${color}|${secondary_color}"
|
||||
[[ -n "${user_info}" ]] && _omb_util_print "$OMB_THEME_POWERLINE_ICON_USER ${user_info} `date +%X\ %D`|${color}|${secondary_color}"
|
||||
}
|
||||
|
||||
function __powerline_cwd_prompt {
|
||||
echo "$(pwd | sed "s|^${HOME}|$OMB_THEME_POWERLINE_ICON_HOME|")|${CWD_THEME_PROMPT_COLOR}"
|
||||
_omb_util_print "$(pwd | sed "s|^${HOME}|$OMB_THEME_POWERLINE_ICON_HOME|")|${CWD_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_last_status_prompt {
|
||||
if [[ "$1" -ne 0 ]]; then
|
||||
echo "$OMB_THEME_POWERLINE_ICON_EXIT_FAILURE${1}|${LAST_STATUS_THEME_PROMPT_COLOR}"
|
||||
_omb_util_print "$OMB_THEME_POWERLINE_ICON_EXIT_FAILURE${1}|${LAST_STATUS_THEME_PROMPT_COLOR}"
|
||||
else
|
||||
echo "$OMB_THEME_POWERLINE_ICON_EXIT_SUCCESS|${LAST_STATUS_THEME_PROMPT_COLOR_SUCCESS}"
|
||||
_omb_util_print "$OMB_THEME_POWERLINE_ICON_EXIT_SUCCESS|${LAST_STATUS_THEME_PROMPT_COLOR_SUCCESS}"
|
||||
fi
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
source "$OSH/themes/powerline/powerline.base.sh"
|
||||
|
||||
function __powerline_last_status_prompt {
|
||||
[[ "$1" -ne 0 ]] && echo "$(set_color ${LAST_STATUS_THEME_PROMPT_COLOR} -) ${1} ${_omb_prompt_normal}"
|
||||
[[ "$1" -ne 0 ]] && _omb_util_print "$(set_color ${LAST_STATUS_THEME_PROMPT_COLOR} -) ${1} ${_omb_prompt_normal}"
|
||||
}
|
||||
|
||||
function __powerline_right_segment {
|
||||
|
@ -69,7 +69,7 @@ function __powerline_user_info_prompt {
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[[ -n "${user_info}" ]] && echo "${user_info}|${color}|${secondary_color}"
|
||||
[[ -n "${user_info}" ]] && _omb_util_print "${user_info}|${color}|${secondary_color}"
|
||||
}
|
||||
|
||||
function __powerline_ruby_prompt {
|
||||
@ -81,7 +81,7 @@ function __powerline_ruby_prompt {
|
||||
ruby_version=$(rbenv_version_prompt)
|
||||
fi
|
||||
|
||||
[[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}"
|
||||
[[ -n "${ruby_version}" ]] && _omb_util_print "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_python_venv_prompt {
|
||||
@ -94,7 +94,7 @@ function __powerline_python_venv_prompt {
|
||||
python_venv=$(basename "${VIRTUAL_ENV}")
|
||||
fi
|
||||
|
||||
[[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}"
|
||||
[[ -n "${python_venv}" ]] && _omb_util_print "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_scm_prompt {
|
||||
@ -116,16 +116,16 @@ function __powerline_scm_prompt {
|
||||
if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then
|
||||
scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}"
|
||||
fi
|
||||
echo "${scm_prompt}${scm}|${color}"
|
||||
_omb_util_print "${scm_prompt}${scm}|${color}"
|
||||
fi
|
||||
}
|
||||
|
||||
function __powerline_cwd_prompt {
|
||||
echo "$(pwd | sed "s|^${HOME}|~|")|${CWD_THEME_PROMPT_COLOR}"
|
||||
_omb_util_print "$(pwd | sed "s|^${HOME}|~|")|${CWD_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_clock_prompt {
|
||||
echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}"
|
||||
_omb_util_print "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_battery_prompt {
|
||||
@ -143,13 +143,13 @@ function __powerline_battery_prompt {
|
||||
color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}"
|
||||
fi
|
||||
ac_adapter_connected && battery_status="${BATTERY_AC_CHAR}${battery_status}"
|
||||
echo "${battery_status}%|${color}"
|
||||
_omb_util_print "${battery_status}%|${color}"
|
||||
fi
|
||||
}
|
||||
|
||||
function __powerline_in_vim_prompt {
|
||||
if [ -n "$VIMRUNTIME" ]; then
|
||||
echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}"
|
||||
_omb_util_print "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ function __powerline_left_segment {
|
||||
}
|
||||
|
||||
function __powerline_last_status_prompt {
|
||||
[[ "$1" -ne 0 ]] && echo "${1}|${LAST_STATUS_THEME_PROMPT_COLOR}"
|
||||
[[ "$1" -ne 0 ]] && _omb_util_print "${1}|${LAST_STATUS_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_prompt_command {
|
||||
|
@ -20,7 +20,7 @@ function scm_prompt {
|
||||
then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -41,14 +41,14 @@ esac
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ ${VIMRUNTIME-} ]]; then
|
||||
echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}vim shell${D_DEFAULT_COLOR} "
|
||||
_omb_util_print "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}vim shell${D_DEFAULT_COLOR} "
|
||||
fi
|
||||
}
|
||||
|
||||
function mitsuhikos_lastcommandfailed {
|
||||
local status=$?
|
||||
if ((status != 0)); then
|
||||
echo " ${D_DEFAULT_COLOR}C:${D_CMDFAIL_COLOR}$code ${D_DEFAULT_COLOR}"
|
||||
_omb_util_print " ${D_DEFAULT_COLOR}C:${D_CMDFAIL_COLOR}$code ${D_DEFAULT_COLOR}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -78,9 +78,9 @@ function prompt_git {
|
||||
branchName=$(
|
||||
_omb_prompt_git symbolic-ref --quiet --short HEAD 2> /dev/null ||
|
||||
_omb_prompt_git rev-parse --short HEAD 2> /dev/null ||
|
||||
echo '(unknown)');
|
||||
_omb_util_print '(unknown)');
|
||||
|
||||
echo "${D_GIT_DEFAULT_COLOR}on ${D_GIT_BRANCH_COLOR}${branchName} "
|
||||
_omb_util_print "${D_GIT_DEFAULT_COLOR}on ${D_GIT_BRANCH_COLOR}${branchName} "
|
||||
else
|
||||
return
|
||||
fi
|
||||
@ -98,9 +98,9 @@ function limited_pwd {
|
||||
if ((offset > 0)); then
|
||||
local truncated_symbol='...'
|
||||
local TRUNCATED_PWD=${RELATIVE_PWD:offset:MAX_PWD_LENGTH}
|
||||
echo -n "${truncated_symbol}/${TRUNCATED_PWD#*/}"
|
||||
_omb_util_put "${truncated_symbol}/${TRUNCATED_PWD#*/}"
|
||||
else
|
||||
echo -n "${RELATIVE_PWD}"
|
||||
_omb_util_put "${RELATIVE_PWD}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -85,14 +85,14 @@ esac
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ ${VIMRUNTIME-} ]]; then
|
||||
echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}vim shell${D_DEFAULT_COLOR} "
|
||||
_omb_util_print "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}vim shell${D_DEFAULT_COLOR} "
|
||||
fi
|
||||
}
|
||||
|
||||
function mitsuhikos_lastcommandfailed {
|
||||
local status=$?
|
||||
if ((status != 0)); then
|
||||
echo "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}$status ${D_DEFAULT_COLOR}"
|
||||
_omb_util_print "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}$status ${D_DEFAULT_COLOR}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ function prompt_git {
|
||||
branchName=$(
|
||||
_omb_prompt_git symbolic-ref --quiet --short HEAD 2> /dev/null ||
|
||||
_omb_prompt_git rev-parse --short HEAD 2> /dev/null ||
|
||||
echo '(unknown)')
|
||||
_omb_util_print '(unknown)')
|
||||
|
||||
[[ $s ]] && s=" [$s]"
|
||||
|
||||
|
@ -34,12 +34,12 @@ function __my_rvm_ruby_version {
|
||||
local version=$(awk -F'-' '{print $2}' <<< "${MY_RUBY_HOME}")
|
||||
[[ $gemset ]] && gemset=@$gemset
|
||||
local full=$version$gemset
|
||||
[[ $full ]] && echo "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}${full}${OMB_THEME_BRACKET_COLOR}]${_omb_prompt_normal}"
|
||||
[[ $full ]] && _omb_util_print "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}${full}${OMB_THEME_BRACKET_COLOR}]${_omb_prompt_normal}"
|
||||
}
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}vim shell${OMB_THEME_BRACKET_COLOR}]${_omb_prompt_normal}"
|
||||
_omb_util_print "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}vim shell${OMB_THEME_BRACKET_COLOR}]${_omb_prompt_normal}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ function todo_txt_count {
|
||||
local count=$(todo.sh ls \
|
||||
| awk '/TODO: [0-9]+ of ([0-9]+) tasks shown/ { print $4 }')
|
||||
if is_integer "${count}"; then # did we get a sane answer back
|
||||
echo "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}T:$count${OMB_THEME_BRACKET_COLOR}]$_omb_prompt_normal"
|
||||
_omb_util_print "${OMB_THEME_BRACKET_COLOR}[${OMB_THEME_STRING_COLOR}T:$count${OMB_THEME_BRACKET_COLOR}]$_omb_prompt_normal"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -65,7 +65,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
|
||||
local char=$OMB_THEME_BRACKET_COLOR[$CHAR$OMB_THEME_BRACKET_COLOR]
|
||||
local info=[$OMB_THEME_STRING_COLOR$(scm_prompt_info)$OMB_THEME_BRACKET_COLOR]
|
||||
printf '%s\n' "$char$info$_omb_prompt_normal"
|
||||
_omb_util_print "$char$info$_omb_prompt_normal"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ OMB_PROMPT_CONDAENV_USE_BASENAME=true
|
||||
OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false}
|
||||
|
||||
function parse_git_dirty {
|
||||
[[ $(_omb_prompt_git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*"
|
||||
[[ $(_omb_prompt_git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && _omb_util_print "*"
|
||||
}
|
||||
function parse_git_branch {
|
||||
_omb_prompt_git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
|
||||
@ -36,7 +36,9 @@ function parse_git_branch {
|
||||
function _omb_theme_PROMPT_COMMAND() {
|
||||
local python_venv
|
||||
_omb_prompt_get_python_venv
|
||||
PS1="$python_venv${MAGENTA}\u ${WHITE}at ${ORANGE}\h ${WHITE}in ${GREEN}\w${WHITE}\$([[ -n \$(_omb_prompt_git branch 2> /dev/null) ]] && echo \" on \")${PURPLE}\$(parse_git_branch)${WHITE}\n\$ ${RESET}"
|
||||
local git_prefix
|
||||
git_prefix=$([[ -n $(_omb_prompt_git branch 2> /dev/null) ]] && _omb_util_print ' on ')
|
||||
PS1="$python_venv${MAGENTA}\u ${WHITE}at ${ORANGE}\h ${WHITE}in ${GREEN}\w${WHITE}$git_prefix${PURPLE}\$(parse_git_branch)${WHITE}\n\$ ${RESET}"
|
||||
}
|
||||
|
||||
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|
||||
|
@ -13,7 +13,7 @@ function _omb_theme_sirup_rubygem {
|
||||
[[ $version == 1.9.2 ]] && version=
|
||||
|
||||
local full=$version$gemset
|
||||
[[ $full ]] && echo "$full"
|
||||
[[ $full ]] && _omb_util_print "$full"
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND {
|
||||
|
@ -27,18 +27,18 @@ function __my_rvm_ruby_version {
|
||||
[[ $gemset ]] && gemset=@$gemset
|
||||
local version=$(awk -F'-' '{print $2}' <<< "$MY_RUBY_HOME")
|
||||
local full=$version$gemset
|
||||
[[ $full ]] && echo "[$full]"
|
||||
[[ $full ]] && _omb_util_print "[$full]"
|
||||
}
|
||||
|
||||
function __my_venv_prompt {
|
||||
if [[ $VIRTUAL_ENV ]]; then
|
||||
echo "[${_omb_prompt_navy}@${_omb_prompt_normal}${VIRTUAL_ENV##*/}]"
|
||||
_omb_util_print "[${_omb_prompt_navy}@${_omb_prompt_normal}${VIRTUAL_ENV##*/}]"
|
||||
fi
|
||||
}
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR == "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)][$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ function __tonka_date {
|
||||
function __tonka_clock {
|
||||
local LIGHT_BLUE="\[\033[1;34m\]"
|
||||
if [[ "${THEME_SHOW_CLOCK}" = "true" ]]; then
|
||||
echo "$(__tonka_time)${LIGHT_BLUE}:$(__tonka_date)${LIGHT_BLUE}:"
|
||||
_omb_util_print "$(__tonka_time)${LIGHT_BLUE}:$(__tonka_date)${LIGHT_BLUE}:"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,12 @@ function __my_rvm_ruby_version {
|
||||
[[ $gemset ]] && gemset=@$gemset
|
||||
local version=$(awk -F'-' '{print $2}' <<< "$MY_RUBY_HOME")
|
||||
local full=$version$gemset
|
||||
[[ $full ]] && echo "[$full]"
|
||||
[[ $full ]] && _omb_util_print "[$full]"
|
||||
}
|
||||
|
||||
function is_vim_shell {
|
||||
if [[ $VIMRUNTIME ]]; then
|
||||
echo "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
_omb_util_print "[${_omb_prompt_teal}vim shell${_omb_prompt_normal}]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ function modern_scm_prompt {
|
||||
if [[ $CHAR == "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
echo "[$(scm_char)][$(scm_prompt_info)]"
|
||||
_omb_util_print "[$(scm_char)][$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ function modern_scm_prompt {
|
||||
function chroot {
|
||||
if [[ $debian_chroot ]]; then
|
||||
local my_ps_chroot=$_omb_prompt_bold_teal$debian_chroot$_omb_prompt_normal
|
||||
echo "($my_ps_chroot)"
|
||||
_omb_util_print "($my_ps_chroot)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -58,9 +58,9 @@ function my_ve {
|
||||
if [[ $VIRTUAL_ENV ]]; then
|
||||
local ve=$(basename "$VIRTUAL_ENV")
|
||||
local my_ps_ve=$_omb_prompt_bold_purple$ve$_omb_prompt_normal
|
||||
echo "($my_ps_ve)"
|
||||
_omb_util_print "($my_ps_ve)"
|
||||
fi
|
||||
echo ""
|
||||
_omb_util_print ""
|
||||
}
|
||||
|
||||
function _omb_theme_PROMPT_COMMAND {
|
||||
|
Loading…
Reference in New Issue
Block a user