Skip to content

Commit b3ad06a

Browse files
authored
fix(cli): force the tui when --output == tui (#331)
# Summary Fixes an issue that prevents the TUI from showing when the user config disables interactive mode but the output flag specifies `tui`. With this change, the output format flag should always win over the config value. The `DISABLE_FLOW_INTERACTIVE` env var is still the used to disable the TUI with that flag set. **Notable Changes** - Removes `tui` as the default output format - Respects the value of `--output=tui` when the user configs disables the TUI Closes #330
1 parent 21f55c9 commit b3ad06a

13 files changed

+20
-15
lines changed

cmd/internal/flags/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ var OutputFormatFlag = &Metadata{
9191
Name: "output",
9292
Shorthand: "o",
9393
Usage: "Output format. One of: yaml, json, or tui.",
94-
Default: "tui",
94+
Default: "",
9595
Required: false,
9696
}
9797

cmd/internal/helpers.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,18 @@ func MarkFlagFilename(_ *context.Context, cmd *cobra.Command, name string) {
5656
}
5757

5858
func TUIEnabled(ctx *context.Context, cmd *cobra.Command) bool {
59-
formatDisabled := false
6059
if flags.HasFlag(cmd, *flags.OutputFormatFlag) {
6160
format := flags.ValueFor[string](cmd, *flags.OutputFormatFlag, false)
62-
formatDisabled = format == "yaml" || format == "yml" || format == "json"
61+
if format == "yaml" || format == "yml" || format == "json" {
62+
return false
63+
}
64+
if format == "tui" {
65+
envDisabled, _ := strconv.ParseBool(os.Getenv(flowIO.DisableInteractiveEnvKey))
66+
return !envDisabled
67+
}
6368
}
6469
envDisabled, _ := strconv.ParseBool(os.Getenv(flowIO.DisableInteractiveEnvKey))
65-
return !formatDisabled && !envDisabled && ctx.Config.ShowTUI()
70+
return !envDisabled && ctx.Config.ShowTUI()
6671
}
6772

6873
func SetView(ctx *context.Context, cmd *cobra.Command, view tuikit.View) {

docs/cli/flow_browse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ flow browse [EXECUTABLE-REFERENCE] [flags]
2424
-h, --help help for browse
2525
-l, --list Show a simple list view of executables instead of interactive discovery.
2626
-n, --namespace string Filter executables by namespace.
27-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
27+
-o, --output string Output format. One of: yaml, json, or tui.
2828
-t, --tag stringArray Filter by tags.
2929
-v, --verb string Filter executables by verb.
3030
--visibility string Filter by visibility level (hierarchical). Valid: public, private, internal, hidden. Default: private

docs/cli/flow_cache_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ flow cache list [flags]
1616

1717
```
1818
-h, --help help for list
19-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
19+
-o, --output string Output format. One of: yaml, json, or tui.
2020
```
2121

2222
### Options inherited from parent commands

docs/cli/flow_config_get.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ flow config get [flags]
1010

1111
```
1212
-h, --help help for get
13-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
13+
-o, --output string Output format. One of: yaml, json, or tui.
1414
```
1515

1616
### Options inherited from parent commands

docs/cli/flow_logs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ flow logs [flags]
1111
```
1212
-h, --help help for logs
1313
--last Print the last execution's logs
14-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
14+
-o, --output string Output format. One of: yaml, json, or tui.
1515
```
1616

1717
### Options inherited from parent commands

docs/cli/flow_secret_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ flow secret list [flags]
1010

1111
```
1212
-h, --help help for list
13-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
13+
-o, --output string Output format. One of: yaml, json, or tui.
1414
-p, --plaintext Output the secret value as plain text instead of an obfuscated string
1515
```
1616

docs/cli/flow_template_get.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ flow template get [flags]
1111
```
1212
-f, --file string Path to the template file. It must be a valid flow file template.
1313
-h, --help help for get
14-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
14+
-o, --output string Output format. One of: yaml, json, or tui.
1515
-t, --template flow set template Registered template name. Templates can be registered in the flow configuration file or with flow set template.
1616
```
1717

docs/cli/flow_template_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ flow template list [flags]
1010

1111
```
1212
-h, --help help for list
13-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
13+
-o, --output string Output format. One of: yaml, json, or tui.
1414
```
1515

1616
### Options inherited from parent commands

docs/cli/flow_vault_get.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ flow vault get NAME [flags]
1010

1111
```
1212
-h, --help help for get
13-
-o, --output string Output format. One of: yaml, json, or tui. (default "tui")
13+
-o, --output string Output format. One of: yaml, json, or tui.
1414
```
1515

1616
### Options inherited from parent commands

0 commit comments

Comments
 (0)