update: formatting, cleanup & order
This commit is contained in:
@ -86,29 +86,6 @@ function git::untracked
|
||||
end
|
||||
end
|
||||
|
||||
# Kubernetes
|
||||
|
||||
function k8s::current_context
|
||||
command kubectl config current-context
|
||||
end
|
||||
|
||||
function k8s::current_namespace
|
||||
command kubectl config view --minify -o jsonpath='{.contexts[0].context.namespace}'
|
||||
end
|
||||
|
||||
# Terraform
|
||||
|
||||
# Test whether this is a terraform directory by finding .tf files
|
||||
function terraform::directory
|
||||
command find . -name '*.tf' >/dev/null ^/dev/null -maxdepth 0
|
||||
end
|
||||
|
||||
function terraform::workspace
|
||||
terraform::directory; and begin
|
||||
test -e .terraform/environment
|
||||
end
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
|
||||
if test "$theme_complete_path" = "yes"
|
||||
@ -123,21 +100,7 @@ function fish_right_prompt
|
||||
end
|
||||
end
|
||||
|
||||
command -sq kubectl; and k8s::current_context >/dev/null 2>/dev/null; and begin
|
||||
set -l k8s_namespace (k8s::current_namespace)
|
||||
if test -z "$k8s_namespace"
|
||||
printf (yellow)"("(dim)(k8s::current_context)(yellow)") "(off)
|
||||
else
|
||||
printf (yellow)"("(dim)(k8s::current_context)"/$k8s_namespace"(yellow)") "(off)
|
||||
end
|
||||
end
|
||||
|
||||
if terraform::workspace
|
||||
set terraform_workspace_name (command cat .terraform/environment)
|
||||
printf (yellow)"("(dim)$terraform_workspace_name(yellow)") "(off)
|
||||
end
|
||||
|
||||
printf (yellow)"("(dim)$cwd(yellow)") "(off)
|
||||
printf (dim)(date +%H(yellow):(dim)%M(yellow):(dim)%S)(off)
|
||||
printf (yellow)"("(off)$cwd(yellow)") "(off)
|
||||
printf (off)(date +%H(yellow):(off)%M(yellow):(off)%S)(off)
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user