Skip to content

Commit

Permalink
Add arg to suppress warning for empty shell var
Browse files Browse the repository at this point in the history
  • Loading branch information
awiddersheim committed Dec 1, 2020
1 parent 79e78b1 commit 498a461
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ Usage of powerline-go:
(default "bash")
-shell-var string
A shell variable to add to the segments.
-shell-var-no-warn-empty
Disables warning for empty shell variable.
-shorten-eks-names
Shortens names for EKS Kube clusters.
-shorten-gke-names
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type args struct {
ShortenGKENames *bool
ShortenEKSNames *bool
ShellVar *string
ShellVarNoWarnEmpty *bool
TrimADDomain *bool
PathAliases *string
Duration *string
Expand Down Expand Up @@ -244,6 +245,10 @@ func main() {
"shell-var",
"",
comments("A shell variable to add to the segments.")),
ShellVarNoWarnEmpty: flag.Bool(
"shell-var-no-warn-empty",
false,
comments("Disables warning for empty shell variable.")),
TrimADDomain: flag.Bool(
"trim-ad-domain",
false,
Expand Down
5 changes: 3 additions & 2 deletions segment-shellvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ func segmentShellVar(p *powerline) []pwl.Segment {
Background: p.theme.ShellVarBg,
}}
}
warn("Shell variable " + shellVarName + " is empty.")

if !*p.args.ShellVarNoWarnEmpty {
warn("Shell variable " + shellVarName + " is empty.")
}
} else {
warn("Shell variable " + shellVarName + " does not exist.")
}
Expand Down

0 comments on commit 498a461

Please sign in to comment.