Skip to content

Commit

Permalink
Fix the EnvVars method
Browse files Browse the repository at this point in the history
Signed-off-by: Svetlin Ralchev <iamralch@users.noreply.github.com>
  • Loading branch information
iamralch committed Oct 16, 2023
1 parent f8fd1a6 commit 46e7580
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion command_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ func (ctx *Context) EnvVars() map[string]string {
accessor := NewFlagAccessor(flag)

for _, name := range split(accessor.EnvVar()) {
variables[name] = fmt.Sprintf("%v", accessor.Value())
// If the value is empty, we don't want to set the environment variable
if name != "" {
if value := fmt.Sprintf("%v", accessor.Value()); value != "" {
variables[name] = value
}
}
}
}

Expand Down

0 comments on commit 46e7580

Please sign in to comment.