summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--01_Internal.zsh93
-rw-r--r--12_Prompts.zsh2
-rw-r--r--net:foret/Colors.zsh6
-rw-r--r--net:foret/Functions.zsh34
-rw-r--r--net:foret/Prompts.zsh18
-rw-r--r--net:foret/user:hiegel/Hashes.zsh1
-rw-r--r--user:hugues/Environment.zsh2
7 files changed, 104 insertions, 52 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh
index eafc0a4..7cd2aa8 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -193,25 +193,25 @@ __get_git_branch ()
commit_ish=$(git rev-parse --verify HEAD 2>/dev/null)
# Get current working GIT branch
- my_git_branch="$(git symbolic-ref --short -q HEAD)"
+ my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)"
# for future use
checkouted_branch=$my_git_branch
- if [ ! "$my_git_branch" ]
+ if [ "$my_git_branch" != "" ]
then
- # Not on a working GIT branch. Get the named current commit-ish inside parenthesis
- [ ! "$my_git_branch" ] &&\
+ # If not on a working GIT branch, get the named current commit-ish inside parenthesis
+ [ "$my_git_branch" = "(no branch)" ] &&\
checkouted_branch="" && \
my_git_branch="$(git name-rev --name-only --always --no-undefined HEAD 2>&- | __cleanup_git_branch_name)"
- #else
- # # Initial commit
- # if [ -L $GIT_DIR/HEAD -a ! -f $GIT_DIR/HEAD ]
- # then
- # my_git_branch="$(basename $(readlink -f $GIT_DIR/HEAD))"
- # else
- # my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))"
- # fi
+ else
+ # Initial commit
+ if [ -L $GIT_DIR/HEAD -a ! -f $GIT_DIR/HEAD ]
+ then
+ my_git_branch="$(basename $(readlink -f $GIT_DIR/HEAD))"
+ else
+ my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))"
+ fi
fi
__debug
@@ -353,46 +353,45 @@ __get_git_tracking_status() {
local git_tracking_status=""
__debug -n " tracking..."
- my_git_branch="$(git symbolic-ref --short -q HEAD)"
- if [ "$my_git_branch" ]
+ my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)"
+ if [ "$my_git_branch" != "(no branch)" -a ! "$(git config --get branch.$my_git_branch.remote)" ]
then
- local _upstream="$(git rev-parse --revs-only HEAD@\{upstream\} 2>/dev/null)"
- if [ ! "$_upstream" ]
+ git_tracking_status=$C_$_gcl_colors[untracked]$_C"✖"
+ fi
+ __debug
+
+ __debug -n " behind/ahead..."
+ # Show number of stashed commits by appending '+' signs for each
+ if [ "$(git rev-parse --is-inside-git-dir)" != "true" -a "$(git config --get core.bare)" != "true" ]
+ then
+ local _ahead=0 ;
+ local _behind=0 ;
+ eval $(git status . | sed -n '
+ /^#$/ { q }
+ s/^# and have \([0-9]\+\) and \([0-9]\+\) different.*/_ahead=\1;\n_behind=\2;\n/p ;
+ s/^# Your branch is \(behind\|ahead\) .* \([0-9]\+\) commit.*/_\1=\2;\n/p ;
+ ')
+
+ # ᛨ ᛪ ⇅ ↟↟ ⇶ ⇶ ⇵ ⌥ ⬆ ⬇ ⬌ ⬍ ⤱ ⤲ ✖ ➠ ➟ ⤴ ⎇⬋⬉⬉⬈⬌⬍⬅⬄
+
+ if [ $_behind -gt 0 ]
then
- git_tracking_status=$C_$_gcl_colors[untracked]$_C"✖"
- else
- __debug
- __debug -n " behind/ahead..."
- # Show number of stashed commits by appending '+' signs for each
- if [ "$(git rev-parse --is-inside-git-dir)" != "true" -a "$(git config --get core.bare)" != "true" ]
+ git_tracking_status+=$C_$_gcl_colors[ffwd]$_C
+ [ $_behind -gt 1 ] && git_tracking_status+="$(echo $_behind | _subscript_number)"
+ git_tracking_status+="⬇"
+ fi
+ if [ $_ahead -gt 0 ]
+ then
+ if [ $_behind -gt 0 ]
then
- local _ahead=0 ;
- local _behind=0 ;
- _ahead=$( git rev-list --count ${_upstream}..${my_git_branch})
- _behind=$(git rev-list --count ${my_git_branch}..${_upstream})
-
- # ᛨ ᛪ ⇅ ↟↟ ⇶ ⇶ ⇵ ⌥ ⬆ ⬇ ⬌ ⬍ ⤱ ⤲ ✖ ➠ ➟ ⤴ ⎇⬋⬉⬉⬈⬌⬍⬅⬄
-
- if [ $_behind -gt 0 ]
- then
- git_tracking_status+=$C_$_gcl_colors[ffwd]$_C
- [ $_behind -gt 1 ] && git_tracking_status+="$(echo $_behind | _subscript_number)"
- git_tracking_status+="⬇"
- fi
- if [ $_ahead -gt 0 ]
- then
- if [ $_behind -gt 0 ]
- then
- git_tracking_status+=$C_$_prompt_colors[generic]$_C
- else
- git_tracking_status+=$C_$_gcl_colors[cached]$_C
- fi
- git_tracking_status+="⬆"
- [ $_ahead -gt 1 ] && git_tracking_status+="$(echo $_ahead | _subscript_number)"
- fi
+ git_tracking_status+=$C_$_prompt_colors[generic]$_C
+ else
+ git_tracking_status+=$C_$_gcl_colors[cached]$_C
fi
+ git_tracking_status+="⬆"
+ [ $_ahead -gt 1 ] && git_tracking_status+="$(echo $_ahead | _subscript_number)"
fi
- fi
+ fi
echo $git_tracking_status
}
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 758bc3d..f4c04e9 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -311,7 +311,9 @@ __two_lines_prompt ()
PS2="$C_$_prompt_colors[soft_generic]$_C$(for i in {2..$#lastline} ; print -n "·" ; tput sc ; print -n "\r")$C_$color[yellow];$color[bold]$_C%_$(tput rc)$C_$color[none]$_C "
__debug "------------------------------"
+ #RPROMPT=$C_$_prompt_colors[bar]$_C"%{"$T_"%}m"${(l:$(($DATESIZE - 3))::q:)}"j%{"$_T"%}"
}
+unset RPROMPT
if ( ! __zsh_status )
then
diff --git a/net:foret/Colors.zsh b/net:foret/Colors.zsh
index d56bcbd..d7bd7c0 100644
--- a/net:foret/Colors.zsh
+++ b/net:foret/Colors.zsh
@@ -2,8 +2,14 @@
typeset -A _make_colors
_make_colors[target]=$color[red]
+
_make_colors[verbose]=$color[yellow]
+
_make_colors[nproc]=$color[yellow]
+
_make_colors[static]=$color[green]
_make_colors[dynamic]=$color[yellow]
+_make_colors[sdk]=$color[cyan]";"$color[bold]
+
+_make_colors[gcc]=$color[blue]";"$color[bold]
diff --git a/net:foret/Functions.zsh b/net:foret/Functions.zsh
new file mode 100644
index 0000000..0a77351
--- /dev/null
+++ b/net:foret/Functions.zsh
@@ -0,0 +1,34 @@
+
+_cn () {
+ local _CN=/usr/local/Cavium_Networks/
+ local SDK MODEL GCC
+ case $1 in
+ ([Oo]+*) MODEL=OCTEON_CN58XX
+ SDK=${2:-OCTEON-SDK-1.7.2}
+ case $1 in
+ (*-) GCC=tools ;;
+ (*) GCC=tools-gcc-4.7.2 ;;
+ esac
+ TARGET=OCTEONPLUS_64-CAVIUMSE-SMP-PERF-EXTFLOW ;;
+ ([Oo]2*) case $1 in
+ (O*) MODEL=OCTEON_CN68XX ;;
+ (o*) MODEL=OCTEON_CN66XX ;;
+ esac
+ SDK=${2:-cnUSERS-SDK-2.3}
+ case $1 in
+ (*-) GCC=tools ;;
+ (*) GCC=tools-gcc-4.7.2 ;;
+ esac
+ TARGET=OCTEON2_64-CAVIUMSE-SMP-PERF-EXTFLOW ;;
+ (*) TARGET=x86_64-LSB-SMP-PERF-EXTFLOW
+ unset OCTEON_ROOT ;;
+ esac
+ PATH=${(j/:/)$(echo ${${(s/:/)PATH}##/usr/local/Cavium_Networks/*})}
+ if [ -n "$SDK" ]
+ then
+ pushd $_CN/$SDK > /dev/null 2>&1
+ source ./env-setup $MODEL --runtime-model --tools=$GCC
+ popd > /dev/null 2>&1
+ fi
+}
+
diff --git a/net:foret/Prompts.zsh b/net:foret/Prompts.zsh
index d93120d..317f8cc 100644
--- a/net:foret/Prompts.zsh
+++ b/net:foret/Prompts.zsh
@@ -8,8 +8,6 @@
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
-_prompt_colors[target]="1;31"
-
__static_dynamic ()
{
[ $(( ${STATIC:-$(( 1 ^ ${DYNAMIC:-0} ))} + ${DYNAMIC:-$(( 1 ^ ${STATIC:-0} ))} )) -lt 2 ] && \
@@ -46,7 +44,7 @@ __compilation_target ()
[ -n "$TARGET" ] || return
echo -n $C_
export | grep -q '^TARGET=' && echo -n "1;"
- echo -n $_make_colors[target]$_C$TARGET
+ echo -n $_make_colors[target]$_C$(echo $TARGET | sed 's/-\([A-Z]\)[A-Z]\+/-\1/g')
}
__verbose_compilation ()
@@ -75,5 +73,17 @@ __makeflags ()
echo -n $_prompt_colors[soft_generic]";3"$_C${MAKEFLAGS// -/}
}
-PS1_TASKBAR+=(__makeflags __verbose_compilation __nproc_compilation __static_dynamic __compilation_os __compilation_arch __compilation_target)
+__octeon_sdk() {
+ [ -z "$OCTEON_ROOT" ] && return
+ echo -n $C_$_make_colors[sdk]$_C
+ echo -n ${OCTEON_ROOT##/usr/local/Cavium_Networks/}
+}
+
+__cavium_gcc_version() {
+ GCC_VERSION=$(echo $PATH | tr ':' '\n' | sed -n "s:$OCTEON_ROOT/tools-gcc-\(.*\)/bin:\1:p;Tend;q;:end" )
+ [ -z "$GCC_VERSION" ] && return
+ echo -n $C_$_make_colors[gcc]$_C$GCC_VERSION
+}
+
+PS1_TASKBAR+=(__makeflags __verbose_compilation __nproc_compilation __static_dynamic __compilation_os __compilation_arch __compilation_target __octeon_sdk __cavium_gcc_version)
PS1_EXTRA_INFO+=()
diff --git a/net:foret/user:hiegel/Hashes.zsh b/net:foret/user:hiegel/Hashes.zsh
index 8f564ca..fc58d3c 100644
--- a/net:foret/user:hiegel/Hashes.zsh
+++ b/net:foret/user:hiegel/Hashes.zsh
@@ -1,4 +1,5 @@
hash -d work=/work/$USER
hash -d share=/share/public/hugues
+hash -d hugues=/home/hugues
diff --git a/user:hugues/Environment.zsh b/user:hugues/Environment.zsh
index 112110e..21d6d8b 100644
--- a/user:hugues/Environment.zsh
+++ b/user:hugues/Environment.zsh
@@ -49,7 +49,7 @@ done
export GREP_COLOR=$color[yellow]\;$color[bold]
export GREP_COLORS="sl="":cx="$color[cyan]":ms="$color[yellow]";"$color[bold]":mc="$color[red]";"$color[bold]":fn="$color[green]""
-__cmd_exists dircolors && eval $(dircolors ~/.dir_colors)
+__cmd_exists dircolors && eval $(dircolors)
export TZ="Europe/Paris"
export TIME_STYLE="+%Y-%b-%d %H:%M:%S"