Skip to content

Commit ceb4aca

Browse files
authored
feat: enable table output format by default (#393)
1 parent 298faa6 commit ceb4aca

12 files changed

Lines changed: 14 additions & 16 deletions

internal/app/azldev/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ func getDisplayVersion() string {
9191
// Constructs a new CLI application instance.
9292
func NewApp(fsFactory opctx.FileSystemFactory, osEnvFactory opctx.OSEnvFactory) *App {
9393
app := &App{
94-
colorMode: ColorModeAuto, // Default to auto-colorization.
95-
reportFormat: ReportFormatJSON, // Default to JSON format for reports.
94+
colorMode: ColorModeAuto, // Default to auto-colorization.
95+
reportFormat: ReportFormatTable, // Default to table format for reports.
9696
fsFactory: fsFactory,
9797
osEnvFactory: osEnvFactory,
9898
}

internal/app/azldev/command.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ func reportResults(env *Env, results interface{}) error {
170170
return reportResultsViaReflectable(env, results, reflectable.FormatMarkdown)
171171
case ReportFormatCSV:
172172
return reportResultsViaReflectable(env, results, reflectable.FormatCSV)
173-
case ReportFormatTable:
174-
return reportResultsViaReflectable(env, results, reflectable.FormatTable)
175173
case ReportFormatJSON:
174+
return reportResultsAsJSON(env, results)
175+
case ReportFormatTable:
176176
fallthrough
177177
default:
178-
return reportResultsAsJSON(env, results)
178+
return reportResultsViaReflectable(env, results, reflectable.FormatTable)
179179
}
180180
}
181181

internal/app/azldev/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func NewEnv(ctx context.Context, options EnvOptions) *Env {
123123
osEnvFactory: options.Interfaces.OSEnvFactory,
124124

125125
// Tool behavior/preferences
126-
defaultReportFormat: ReportFormatJSON,
126+
defaultReportFormat: ReportFormatTable,
127127
colorMode: ColorModeAuto,
128128
reportFile: os.Stdout,
129129
verbose: false,

internal/app/azldev/env_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ func TestNewEnv(t *testing.T) {
4747
env := azldev.NewEnv(ctx, options)
4848

4949
// Pin defaults.
50-
// NOTE: When table reporting is available, that will become the new default.
5150
assert.False(t, env.AllPromptsAccepted())
5251
assert.False(t, env.PromptsAllowed())
53-
assert.Equal(t, azldev.ReportFormatJSON, env.DefaultReportFormat())
52+
assert.Equal(t, azldev.ReportFormatTable, env.DefaultReportFormat())
5453
assert.False(t, env.DryRun())
5554
assert.Equal(t, env.ReportFile(), os.Stdout)
5655
assert.False(t, env.Quiet())

scenario/__snapshots__/TestAzlDevConfigDump_stdout_1.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ output-dir = '/workdir/out'
99
specs = ['/workdir/**/*.spec']
1010
excluded-paths = ['/workdir/build/**', '/workdir/out/**']
1111

12-
""

scenario/__snapshots__/TestSnapshotsContainer_--bogus-flag_stderr_1.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Flags:
2020
-n, --dry-run dry run only (do not take action)
2121
-h, --help help for azldev
2222
--no-default-config disable default configuration
23-
-O, --output-format fmt output format {csv, json, markdown, table} (default json)
23+
-O, --output-format fmt output format {csv, json, markdown, table} (default table)
2424
-C, --project string path to Azure Linux project
2525
-q, --quiet only enable minimal output
2626
-v, --verbose enable verbose output

scenario/__snapshots__/TestSnapshotsContainer_--help_stdout_1.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Flags:
2121
-n, --dry-run dry run only (do not take action)
2222
-h, --help help for azldev
2323
--no-default-config disable default configuration
24-
-O, --output-format fmt output format {csv, json, markdown, table} (default json)
24+
-O, --output-format fmt output format {csv, json, markdown, table} (default table)
2525
-C, --project string path to Azure Linux project
2626
-q, --quiet only enable minimal output
2727
-v, --verbose enable verbose output

scenario/__snapshots__/TestSnapshotsContainer_help_stdout_1.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Flags:
2121
-n, --dry-run dry run only (do not take action)
2222
-h, --help help for azldev
2323
--no-default-config disable default configuration
24-
-O, --output-format fmt output format {csv, json, markdown, table} (default json)
24+
-O, --output-format fmt output format {csv, json, markdown, table} (default table)
2525
-C, --project string path to Azure Linux project
2626
-q, --quiet only enable minimal output
2727
-v, --verbose enable verbose output

scenario/__snapshots__/TestSnapshots_--bogus-flag_stderr_1.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Flags:
2020
-n, --dry-run dry run only (do not take action)
2121
-h, --help help for azldev
2222
--no-default-config disable default configuration
23-
-O, --output-format fmt output format {csv, json, markdown, table} (default json)
23+
-O, --output-format fmt output format {csv, json, markdown, table} (default table)
2424
-C, --project string path to Azure Linux project
2525
-q, --quiet only enable minimal output
2626
-v, --verbose enable verbose output

scenario/__snapshots__/TestSnapshots_--help_stdout_1.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Flags:
2121
-n, --dry-run dry run only (do not take action)
2222
-h, --help help for azldev
2323
--no-default-config disable default configuration
24-
-O, --output-format fmt output format {csv, json, markdown, table} (default json)
24+
-O, --output-format fmt output format {csv, json, markdown, table} (default table)
2525
-C, --project string path to Azure Linux project
2626
-q, --quiet only enable minimal output
2727
-v, --verbose enable verbose output

0 commit comments

Comments
 (0)