Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/state/internal/cmdtree/cmdtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ func newStateCommand(globals *globalOptions, prime *primer.Values) *captain.Comm
Shorthand: "o",
Description: locale.T("flag_state_output_description"),
Persist: true,
Value: &globals.Output,
OnUse: func() {
if prime.Output().Type().IsStructured() {
globals.NonInteractive = true
}
Comment on lines +299 to +301
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is called after our outputer is updated to use the type given on the command line, so we know at this time if it's structured (e.g. json) or not (e.g. plain).

},
Value: &globals.Output,
},
{
Name: "non-interactive", // Name and Shorthand should be kept in sync with cmd/state/output.go
Expand Down
Loading