Skip to content

Commit 396b204

Browse files
committed
feat: --debug flag
fixes #50
1 parent d20eccf commit 396b204

File tree

7 files changed

+7
-4
lines changed

7 files changed

+7
-4
lines changed

src/cmd/cli/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ func main() {
610610
rootCmd.PersistentFlags().Var(&colorMode, "color", `Colorize output; "auto", "always" or "never"`)
611611
rootCmd.PersistentFlags().StringVarP(&server, "cluster", "s", defFabric, "Cluster to connect to")
612612
rootCmd.PersistentFlags().BoolVarP(&cli.DoVerbose, "verbose", "v", false, "Verbose logging")
613+
rootCmd.PersistentFlags().BoolVar(&cli.DoDebug, "debug", false, "Debug logging")
613614
rootCmd.PersistentFlags().BoolVar(&cli.DoDryRun, "dry-run", false, "Dry run (don't actually change anything)")
614615
rootCmd.PersistentFlags().BoolVarP(&nonInteractive, "non-interactive", "T", !hasTty, "Disable interactive prompts / no TTY")
615616
rootCmd.PersistentFlags().StringP("cwd", "C", "", "Change directory before running the command")

src/pkg/cli/colorizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func Println(c Color, v ...any) (int, error) {
9494
}
9595

9696
func Debug(v ...any) (int, error) {
97-
if !DoVerbose {
97+
if !DoDebug {
9898
return 0, nil
9999
}
100100
return Fprintln(os.Stderr, DebugColor, v...)

src/pkg/cli/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
var (
1313
DoVerbose = false
14+
DoDebug = false
1415
DoDryRun = false
1516
)
1617

src/pkg/cli/compose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func loadDockerCompose(filePath, projectName string) (*types.Project, error) {
117117
return nil, err
118118
}
119119

120-
if DoVerbose {
120+
if DoDebug {
121121
b, _ := yaml.Marshal(project)
122122
fmt.Println(string(b))
123123
}

src/pkg/cli/composeStart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func ComposeStart(ctx context.Context, client defangv1connect.FabricControllerCl
382382
continue
383383
}
384384

385-
if DoVerbose {
385+
if DoDebug {
386386
PrintObject(service.Name, serviceInfo.Msg)
387387
}
388388
serviceInfos = append(serviceInfos, serviceInfo.Msg)

src/pkg/cli/compose_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func TestNormalizeServiceName(t *testing.T) {
4545

4646
func TestLoadDockerCompose(t *testing.T) {
4747
DoVerbose = true
48+
DoDebug = true
4849

4950
t.Run("no project name", func(t *testing.T) {
5051
_, err := loadDockerCompose("../../tests/compose.yaml", "")

src/pkg/cli/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func Generate(ctx context.Context, client defangv1connect.FabricControllerClient
2424
return nil, err
2525
}
2626

27-
if DoVerbose {
27+
if DoDebug {
2828
// Print the files that were generated
2929
for _, file := range response.Msg.Files {
3030
Debug(file.Name + "\n```")

0 commit comments

Comments
 (0)