Remove unused and refactor
parent
19e9411404
commit
28d2b84e32
@ -1,15 +1,20 @@
|
||||
{{- $development := promptBoolOnce . "development" "is this a development environment [false]" -}}
|
||||
{{- $hellotech := promptBoolOnce . "hellotech" "include work tools [false]" -}}
|
||||
{{- $personal_dev := promptBoolOnce . "personal_dev" "is this a personal development environment [false]" -}}
|
||||
{{- $git_email := promptStringOnce . "git_email" "email to use in git config" -}}
|
||||
{{- $git_name := promptStringOnce . "git_name" "name to use in git config" -}}
|
||||
{{- $include_legacy := promptBoolOnce . "include_legacy" "include old scripts [false]" -}}
|
||||
{{- $bws_token := promptStringOnce . "bws_token" "BitWarden Secrets Manager Access Token" -}}
|
||||
{{- $work := promptBoolOnce . "work" "include work tools [false]" -}}
|
||||
|
||||
encryption = "age"
|
||||
|
||||
[age]
|
||||
identity = "{{ .chezmoi.homeDir }}/.config/chezmoi/key.txt"
|
||||
recipient = "age166qk8xkvd5cx2mqfxenw0mvmg4ghv7jzg8ffr0f0dave5lwzm38qswha8c"
|
||||
|
||||
[data]
|
||||
bws_token = {{ $bws_token | quote }}
|
||||
development = {{ $development }}
|
||||
hellotech = {{ $hellotech }}
|
||||
git_email = "{{ $git_email }}"
|
||||
git_name = "{{ $git_name }}"
|
||||
personal_dev = {{ $personal_dev }}
|
||||
include_legacy = {{ $include_legacy }}
|
||||
work = {{ $work }}
|
||||
|
@ -0,0 +1,6 @@
|
||||
# chezmoi:template:left-delimiter=#{{
|
||||
#{{- /* vim: set filetype=gitconfig: */ -}}
|
||||
#{{ if and .personal_dev (lookPath "git") -}}
|
||||
[url "ssh://git@git.buddy.wtf"]
|
||||
insteadOf = https://git.buddy.wtf
|
||||
#{{- end }}
|
@ -0,0 +1,6 @@
|
||||
# chezmoi:template:left-delimiter=#{{
|
||||
#{{- /* vim: set filetype=gitconfig: */ -}}
|
||||
#{{ if and .personal_dev (lookPath "git") -}}
|
||||
[url "ssh://git@git.xbudex.com:2022"]
|
||||
insteadOf = https://git.xbudex.com
|
||||
#{{- end }}
|
@ -0,0 +1,11 @@
|
||||
# chezmoi:template:left-delimiter=#{{
|
||||
#{{- /* vim: set filetype=gitconfig: */ -}}
|
||||
#{{ if and .work (lookPath "git") -}}
|
||||
[url "git@github.com:HelloTech"]
|
||||
insteadOf = https://github.com/HelloTech
|
||||
|
||||
#{{ if lookPath "node" -}}
|
||||
[init]
|
||||
templateDir = #{{ .chezmoi.homeDir }}/.config/git/template
|
||||
#{{- end }}
|
||||
#{{- end }}
|
@ -1,5 +0,0 @@
|
||||
# chezmoi:template:left-delimiter=#{{
|
||||
#{{- /* vim: set filetype=sh: */ -}}
|
||||
#{{- if .bws_token -}}
|
||||
BWS_ACCESS_TOKEN=#{{ .bws_token }}
|
||||
#{{- end }}
|
@ -1,22 +0,0 @@
|
||||
k8s_last_config () (
|
||||
dasel --read yaml --write json \
|
||||
| jq --raw-output '.metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"]' \
|
||||
| dasel --read json --write yaml \
|
||||
| bat --language yaml
|
||||
)
|
||||
|
||||
_append_path () {
|
||||
if [ ! -d "$1" ]; then
|
||||
return
|
||||
fi
|
||||
case "${PATH}" in
|
||||
*"$1"*) return ;;
|
||||
*) ;;
|
||||
esac
|
||||
PATH="${PATH}:${1}"
|
||||
}
|
||||
|
||||
_append_path /usr/local/opt/mysql-client/bin
|
||||
_append_path "${HOME}/google-cloud-sdk/bin"
|
||||
|
||||
unset _append_path
|
@ -1,81 +0,0 @@
|
||||
# chezmoi:template:left-delimiter=#{{
|
||||
#{{- /* vim: set filetype=jq: */ -}}
|
||||
#{{- if and .hellotech (lookPath "jq") -}}
|
||||
import "colors" as colors;
|
||||
|
||||
def clean_multierror:
|
||||
if . == null then empty
|
||||
else sub("1 error occurred:\n\t\\* "; ""; "mg")
|
||||
| sub("\n+$"; ""; "gm") | sub("\t\\*"; " →"; "g")
|
||||
end;
|
||||
|
||||
def _local_time:
|
||||
sub("\\.\\d+Z$"; "Z"; "g")
|
||||
| fromdate
|
||||
| strflocaltime("%b %m %I:%M:%S %Z");
|
||||
|
||||
def gcp_clean_log:
|
||||
map(
|
||||
(.severity | ascii_downcase) as $level
|
||||
| .timestamp as $ts
|
||||
| .jsonPayload
|
||||
| setpath(["level"]; $level)
|
||||
| setpath(["timestamp"]; $ts | _local_time)
|
||||
| .error?.Error |= clean_multierror
|
||||
);
|
||||
|
||||
def lift_payload: map(.jsonPayload);
|
||||
def lift_error: lift_payload | .[]?.error?.Error |= clean_multierror;
|
||||
|
||||
def level_color: {
|
||||
debug: colors::black,
|
||||
info: colors::blue,
|
||||
warning: colors::yellow,
|
||||
error: colors::red,
|
||||
};
|
||||
|
||||
def _show_op: "[" +.Package + " " + .Op + "]";
|
||||
def _show_stack: .Stack | map(" → " + _show_op + "\t" + .Message) | join("\n");
|
||||
def _show_error:
|
||||
.error
|
||||
| if .Error
|
||||
then _show_op + " " + .Error + "\n" + _show_stack
|
||||
else . end;
|
||||
|
||||
def _show_level:
|
||||
( if .level == "debug" then level_color.debug
|
||||
elif .level == "info" then level_color.info
|
||||
elif .level == "warning" then level_color.warning
|
||||
elif .level == "error" then level_color.error
|
||||
else colors::reset end
|
||||
) as $color
|
||||
| colors::reset + "[" + $color + (.level | ascii_upcase) + colors::reset + "]";
|
||||
|
||||
def _show_props($ignore):
|
||||
( ["timestamp", "message", "level", "error", "admin_id", "client_id",
|
||||
"service", "source", $ignore]
|
||||
| flatten(1)
|
||||
| join("|")
|
||||
) as $regex
|
||||
| to_entries
|
||||
| sort_by(.key)
|
||||
| [.[]
|
||||
| select(false == (.key | test("(" + $regex + ")")))
|
||||
| select(.value)
|
||||
| select(.value != 0)
|
||||
| colors::blue + "\(.key)" + colors::black + "=" + colors::yellow + "\(.value)" + colors::reset
|
||||
]
|
||||
| join(" ");
|
||||
|
||||
def show:
|
||||
["githash", "request_id", "path", "package"] as $ignore
|
||||
| gcp_clean_log
|
||||
| .[]
|
||||
| colors::magenta + .timestamp + colors::reset +
|
||||
" [" + _show_props($ignore) + "]\n" +
|
||||
_show_level + " " + colors::white + .message + (
|
||||
if .error then
|
||||
"\n" + colors::red + "ERROR" + colors::reset + ": " + _show_error
|
||||
else "" end
|
||||
) + colors::reset;
|
||||
#{{- end }}
|
@ -0,0 +1,10 @@
|
||||
require assert/command
|
||||
|
||||
assert_command bat dasel jq
|
||||
|
||||
k8s_last_config() (
|
||||
dasel --read yaml --write json |
|
||||
jq --raw-output '.metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"]' |
|
||||
dasel --read json --write yaml |
|
||||
bat --language yaml
|
||||
)
|
Loading…
Reference in New Issue