Repository navigation
refactor(cmd): unify CLI output format under --result-format #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
7ff2ec7
2231339
629e503
e0fedf1
5202d59
24d039f
b67afe7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,11 @@ func (cmd *ExecCmd) Run(ctx context.Context, args []string) error { | |
| probedEnv := probeContainerEnv(ctx, target, userEnvProbe) | ||
| envMap := buildExecEnv(result, cmd.RemoteEnv, probedEnv) | ||
|
|
||
| emitJSON := output.ResolveMode(cmd.ResultFormat) == output.ModeJSON | ||
| mode, err := output.ResolveMode(cmd.ResultFormat) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| emitJSON := mode == output.ModeJSON | ||
|
Comment on lines
+180
to
+184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve output mode before Docker/container probing. Line 176 and Line 235 validate Proposed fix func (cmd *ExecCmd) Run(ctx context.Context, args []string) error {
+ mode, err := output.ResolveMode(cmd.ResultFormat)
+ if err != nil {
+ return err
+ }
+ emitJSON := mode == output.ModeJSON
+
@@
- mode, err := output.ResolveMode(cmd.ResultFormat)
- if err != nil {
- return err
- }
- emitJSON := mode == output.ModeJSON
-
err = cmd.execInContainer(ctx, execOpts{
@@
func (cmd *ExecCmd) runWithContainerID(ctx context.Context, args []string) error {
+ mode, err := output.ResolveMode(cmd.ResultFormat)
+ if err != nil {
+ return err
+ }
+ emitJSON := mode == output.ModeJSON
+
dockerCommand := defaultDockerCommand
@@
- mode, err := output.ResolveMode(cmd.ResultFormat)
- if err != nil {
- return err
- }
- emitJSON := mode == output.ModeJSON
-
err = cmd.execInContainer(ctx, execOpts{Also applies to: 235-239 🤖 Prompt for AI Agents |
||
|
|
||
| err = cmd.execInContainer(ctx, execOpts{ | ||
| target: target, | ||
|
|
@@ -228,7 +232,11 @@ func (cmd *ExecCmd) runWithContainerID(ctx context.Context, args []string) error | |
|
|
||
| workdir := containerDetails.Config.WorkingDir | ||
|
|
||
| emitJSON := output.ResolveMode(cmd.ResultFormat) == output.ModeJSON | ||
| mode, err := output.ResolveMode(cmd.ResultFormat) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| emitJSON := mode == output.ModeJSON | ||
|
|
||
| err = cmd.execInContainer(ctx, execOpts{ | ||
| target: target, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.