Skip to content
Permalink
Browse files

Three fixes

- ugly error not dislaying return codes 2-8
- error in gitwb() in case the path contains spaces
- better vdump function
  • Loading branch information
micharbet committed Nov 6, 2019
1 parent b9271ff commit cae38dea709013e58cad61d0f1b58c11d5330c12
Showing with 16 additions and 14 deletions.
  1. +5 −5 clerc
  2. +7 −5 clerc.sh
  3. +3 −3 doc/Credits.md
  4. +1 −1 logo/clelogo.sh
10 clerc
@@ -4,7 +4,7 @@
##
#* author: Michael Arbet (marbet@redhat.com)
#* home: https://github.com/micharbet/CLE
#* version: 2019-10-16 (Zodiac)
#* version: 2019-11-04 (Zodiac)
#* license: GNU GPL v2
#* Copyright (C) 2016-2019 by Michael Arbet

@@ -335,7 +335,7 @@ _PST='${PIPESTATUS[@]}'
[ "$BASH_VERSINFO" = 3 ] && _PST='$?'
precmd () {
eval "_EC=$_PST"
[[ $_EC =~ [1..9] ]] || _EC=0
[[ $_EC =~ [1-9] ]] || _EC=0
local IFS S DT C
unset IFS
[ $BASH ] && C=`HISTTIMEFORMAT=";$CLE_HTF;" history 1` || C=`fc -lt ";$CLE_HTF;" -1`
@@ -550,7 +550,7 @@ _clehhout () (
## `gitwb` - show current working branch name
gitwb () (
# go down the folder tree and look for .git
while [ $PWD != / ]; do
while [ "$PWD" != / ]; do
[ -d .git ] && { git symbolic-ref --short HEAD; return; }
cd ..
done
@@ -571,7 +571,7 @@ mdfilter () {
## `vdump 'regexp'` - dump variables in reusable way
vdump () (
typeset 2>/dev/null | awk '/.* \(\)/{exit} /^('$1')=/{gsub(/\\C-\[/,"\\E");print}'
typeset 2>/dev/null | awk '/.* \(\)/{exit} /(^'$1')=/{gsub(/\\C-\[/,"\\E");print}'
)
@@ -611,7 +611,7 @@ lssh () (
command ssh -t $* "
H=/var/tmp/\$USER; mkdir -m 755 -p \$H; cd \$H
[ \"\$OSTYPE\" = darwin ] && D=D || D=d
echo $C64|base64 -\$D|tar xzf -
echo $C64|base64 -\$D|tar xzmf -
exec \$H/$RC -m $CLE_ARG"
)
@@ -4,7 +4,7 @@
##
#* author: Michael Arbet (marbet@redhat.com)
#* home: https://github.com/micharbet/CLE
#* version: 2019-10-16 (Zodiac)
#* version: 2019-11-04 (Zodiac)
#* license: GNU GPL v2
#* Copyright (C) 2016-2019 by Michael Arbet

@@ -441,7 +441,9 @@ _PST='${PIPESTATUS[@]}' #: status of all command in pipeline has different name
[ "$BASH_VERSINFO" = 3 ] && _PST='$?' #: RHEL5/bash3 workaround, check behaviour on OSX, though, ev. remove this line
precmd () {
eval "_EC=$_PST"
[[ $_EC =~ [1..9] ]] || _EC=0 #: just one zero if all ok
dbg_var _PST
dbg_var _EC
[[ $_EC =~ [1-9] ]] || _EC=0 #: just one zero if all ok
local IFS S DT C
unset IFS
[ $BASH ] && C=`HISTTIMEFORMAT=";$CLE_HTF;" history 1` || C=`fc -lt ";$CLE_HTF;" -1`
@@ -690,7 +692,7 @@ gitwb () (
# go down the folder tree and look for .git
#: Because this function is supposed to use in prompt we want to save
#: cpu cycles. Do not call `git` if not necessary.
while [ $PWD != / ]; do
while [ "$PWD" != / ]; do
[ -d .git ] && { git symbolic-ref --short HEAD; return; }
cd ..
done
@@ -718,7 +720,7 @@ vdump () (
#: awk: 1. exits when reaches functions
#: 2. finds variables matching regular expression
#: 3. replaces weird escape sequence '\C-[' from zsh to normal '\E'
typeset 2>/dev/null | awk '/.* \(\)/{exit} /^('$1')=/{gsub(/\\C-\[/,"\\E");print}'
typeset 2>/dev/null | awk '/.* \(\)/{exit} /(^'$1')=/{gsub(/\\C-\[/,"\\E");print}'
)
#:------------------------------------------------------------:#
@@ -779,7 +781,7 @@ lssh () (
H=/var/tmp/\$USER; mkdir -m 755 -p \$H; cd \$H
export CLE_DEBUG='$CLE_DEBUG' # dbg
[ \"\$OSTYPE\" = darwin ] && D=D || D=d
echo $C64|base64 -\$D|tar xzf -
echo $C64|base64 -\$D|tar xzmf -
exec \$H/$RC -m $CLE_ARG"
#: it is not possible to use `base63 -\$D <<<$C64|tar xzf -`
#: systems with 'ash' instead of bash would generate an error (e.g. Asustor)
@@ -16,7 +16,7 @@
- Savitoj Singh (savsingh@redhat.com)
- Vaclav Hodina (vhodina@redhat.com)
- Nenad Peric (nperic@redhat.com)
- Alex Silva (alexsilv@redhat.com) had inspiring comments on tweaks,
he basically made me to remove several tweaks that resulted in simplified
but more useful and universal, yet less pushy environment.
- Alex Silva (alexsilv@redhat.com) had very inspiring comments and reported
several bugs. He basically made me to remove a few tweaks that resulted
in more useful, universal, yet less pushy environment.

@@ -34,5 +34,5 @@ EOL
}

# choose cmdline
cur_ul
#cur_ul

0 comments on commit cae38de

Please sign in to comment.
You can’t perform that action at this time.