Skip to content

Commit

Permalink
Add export env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Sheiko committed Jul 10, 2023
1 parent f18df14 commit a883c3f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ func NewCmdConfig() *cobra.Command {
}
sort.Strings(keys)

exportFlag, _ := cmd.Flags().GetBool("export")
prefix := ""
if exportFlag {
prefix = "export "
}

for _, key := range keys {
fmt.Println(key + "=" + cfg[key])
fmt.Println(prefix + key + "=" + cfg[key])
}
return nil
},
Expand Down Expand Up @@ -132,6 +138,9 @@ func NewCmdConfig() *cobra.Command {
cmd.Flags().StringVarP(&encryptString, "string", "", "", "Encrypt the specified string")
cmd.Flags().VarP(&valueFiles, "values", "f", "Encrypt secrets in a file (can specify multiple)")
} else {
if cmd.Use == "dotenv" {
cmd.Flags().BoolP("export", "e", false, "Print export statements")
}
addAppFlags(cmd)
cmd.Flags().MarkHidden("include-namespace")
cmd.Flags().MarkHidden("snapshot")
Expand Down

0 comments on commit a883c3f

Please sign in to comment.