Skip to content

Commit

Permalink
Merge pull request #256 from awiddersheim/fix_shellvar_warning
Browse files Browse the repository at this point in the history
Add arg to suppress warning for empty shell var
  • Loading branch information
justjanne authored Jan 5, 2021
2 parents cf983f6 + 498a461 commit 92e6490
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 @@ -248,6 +248,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 @@ -55,6 +55,7 @@ type args struct {
ShortenGKENames *bool
ShortenEKSNames *bool
ShellVar *string
ShellVarNoWarnEmpty *bool
TrimADDomain *bool
PathAliases *string
Duration *string
Expand Down Expand Up @@ -251,6 +252,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 92e6490

Please sign in to comment.