Fix prompts and a minor alignment in gitfetch

This commit is contained in:
Andrea Mistrali 2021-12-21 07:59:31 +01:00
parent 4a7b17c07b
commit 8d0b2db580
No known key found for this signature in database
GPG Key ID: 6FB0A77F6D5DA9B2
3 changed files with 39 additions and 30 deletions

View File

@ -14,9 +14,10 @@ blocks:
style: plain style: plain
foreground: yellow foreground: yellow
properties: properties:
postfix: ' ' postfix: ""
prefix: "" prefix: ""
template: '{{if .SSHSession}}@{{ .ComputerName }}{{end}}' template: '{{if .SSHSession}}@{{ .ComputerName }} {{end}}'
- type: root - type: root
style: plain style: plain
@ -25,9 +26,12 @@ blocks:
postfix: "" postfix: ""
prefix: "" prefix: ""
root_icon: "\u26A1" root_icon: "\u26A1"
# root_icon: "# "
- type: path - type: path
style: plain style: plain
# style: agnoster_left
max_depth: 2
foreground: lightBlue foreground: lightBlue
properties: properties:
prefix: "" prefix: ""
@ -35,23 +39,24 @@ blocks:
- type: git - type: git
style: plain style: plain
foreground: darkGray foreground: yellow
properties: properties:
branch_ahead_icon: <#88C0D0></> branch_ahead_icon: <#88C0D0></>
branch_behind_icon: <#88C0D0></> branch_behind_icon: <#88C0D0></>
branch_icon: "\uE0A0" branch_icon: ""
display_status: true display_status: true
fetch_status: true fetch_status: true
prefix: "" prefix: ""
template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{if .Staging.Changed }}{{ .Staging.String }}{{ end }}' template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
# template: '{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
- type: executiontime - type: executiontime
style: plain style: plain
foreground: darkGray foreground: yellow
properties: properties:
always_enabled: false always_enabled: false
postfix: "" postfix: ""
prefix: "\uF017 " prefix: " "
style: austin style: austin
threshold: 30000 threshold: 30000
@ -61,32 +66,28 @@ blocks:
- type: aws - type: aws
style: plain style: plain
foreground: yellow foreground: "#ffA000"
properties: properties:
postfix: "" postfix: ""
# prefix: " " prefix: " "
prefix: "\u2601 " # prefix: " "
template: '{{if .Profile}}{{.Profile}}{{end}}' template: '{{if .Profile}}{{.Profile}}{{end}}'
- type: kubectl - type: kubectl
style: plain style: plain
foreground: magenta foreground: lightBlue
properties: properties:
parse_kubeconfig: true parse_kubeconfig: true
postfix: "" postfix: ""
prefix: " " prefix: ""
template: '{{if eq "on" .Env.KUBE_PS1_ENABLED}}ﴱ {{.Context}}/{{if .Namespace}}{{.Namespace}}{{else}}default{{end}}{{end}}' template: '{{if eq "on" .Env.KUBE_PS1_ENABLED}} ﴱ {{.Context}}/{{if .Namespace}}{{.Namespace}}{{else}}default{{end}}{{end}}'
# - type: command
# style: plain
# foreground: white
# prefix: ""
# postfix: ""
# properties:
# shell: /bin/sh
# # command: "ifconfig utun2 > /dev/null 2>&1 && echo '\uF023' || echo ''"
# command: "ifconfig utun2 > /dev/null 2>&1 && echo '\u2692' || echo ''"
- type: command
style: plain
foreground: white
properties:
shell: /bin/sh
command: "ifconfig utun2 > /dev/null 2>&1 && echo '<#00FF00>\uF023</>' || echo '\0'"
- type: prompt - type: prompt
alignment: left alignment: left

View File

@ -28,8 +28,11 @@ blocks:
root_icon: "\u26A1" root_icon: "\u26A1"
# root_icon: "# " # root_icon: "# "
- type: path - type: path
style: plain style: plain
# style: agnoster_left
max_depth: 2
foreground: lightBlue foreground: lightBlue
properties: properties:
prefix: "" prefix: ""
@ -46,6 +49,7 @@ blocks:
fetch_status: true fetch_status: true
prefix: "" prefix: ""
template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}' template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
# template: '{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
- type: executiontime - type: executiontime
style: plain style: plain
@ -82,12 +86,11 @@ blocks:
# - type: command # - type: command
# style: plain # style: plain
# foreground: white # foreground: white
# prefix: ""
# postfix: ""
# properties: # properties:
# shell: /bin/sh # shell: /bin/sh
# # command: "ifconfig utun2 > /dev/null 2>&1 && echo '\uF023' || echo ''" # # command: "ifconfig utun2 > /dev/null 2>&1 && echo '\uF023' || echo ''"
# command: "ifconfig utun2 > /dev/null 2>&1 && echo '\u2713' || echo '\u2717'" # # command: "ifconfig utun2 > /dev/null 2>&1 && echo '<#00FF00>\u2713</>' || echo '\u2717'"
# command: "ifconfig utun2 > /dev/null 2>&1 && echo '<#00FF00>\u2713</>' || echo ' '"
- type: prompt - type: prompt

View File

@ -2,8 +2,13 @@ local _gitdir
local last_fetch local last_fetch
local diff local diff
# exec 3>&1 4>&2
# trap 'exec 2>&4 1>&3' 0 1 2 3
# exec 1>>~/tmp/gitfetch.log 2>&1
cd $1 cd $1
gitdir=$(git rev-parse --git-dir 2> /dev/null) || return 0 gitdir=$(git rev-parse --git-dir 2> /dev/null) || return 0
last_fetch=$(zstat +mtime $gitdir/FETCH_HEAD 2> /dev/null || echo 0) last_fetch=$(zstat +mtime $gitdir/FETCH_HEAD 2> /dev/null || echo 0)
let "diff = $(strftime %s) - $last_fetch" let "diff = $(strftime %s) - $last_fetch"
@ -55,7 +60,7 @@ if [ $diff -gt ${GIT_FETCH_INTERVAL:-30} ]; then
command git -c gc.auto=0 fetch \ command git -c gc.auto=0 fetch \
--quiet \ --quiet \
--no-tags \ --no-tags \
--recurse-submodules=no \ --recurse-submodules=yes \
$remote &>/dev/null & $remote &>/dev/null &
wait $! || return $fail_code wait $! || return $fail_code