From 518b2c64d9d789970d3a9ad1d8102320ded5a829 Mon Sep 17 00:00:00 2001 From: thibaud-leclere Date: Fri, 10 Apr 2026 09:40:23 +0200 Subject: [PATCH] fix: tighten task 1 cli skeleton --- cmd/email-mcp/main.go | 2 +- internal/cli/app.go | 2 +- internal/cli/app_test.go | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cmd/email-mcp/main.go b/cmd/email-mcp/main.go index 4a8b2e8..bcccbb1 100644 --- a/cmd/email-mcp/main.go +++ b/cmd/email-mcp/main.go @@ -8,7 +8,7 @@ import ( ) func main() { - app := cli.NewApp(nil, nil, nil, nil) + app := cli.NewApp() if err := app.Run(os.Args[1:]); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) diff --git a/internal/cli/app.go b/internal/cli/app.go index 03db9ea..b964d8b 100644 --- a/internal/cli/app.go +++ b/internal/cli/app.go @@ -4,7 +4,7 @@ import "fmt" type App struct{} -func NewApp(_, _, _, _ any) *App { +func NewApp() *App { return &App{} } diff --git a/internal/cli/app_test.go b/internal/cli/app_test.go index 1bd1eb3..3af3df8 100644 --- a/internal/cli/app_test.go +++ b/internal/cli/app_test.go @@ -6,7 +6,7 @@ import ( ) func TestAppRunRejectsUnknownCommand(t *testing.T) { - app := NewApp(nil, nil, nil, nil) + app := NewApp() err := app.Run([]string{"unknown"}) if err == nil { @@ -15,7 +15,7 @@ func TestAppRunRejectsUnknownCommand(t *testing.T) { } func TestAppRunShowsUsageWhenNoArgsProvided(t *testing.T) { - app := NewApp(nil, nil, nil, nil) + app := NewApp() err := app.Run(nil) if err == nil { @@ -25,3 +25,15 @@ func TestAppRunShowsUsageWhenNoArgsProvided(t *testing.T) { t.Fatalf("expected usage text in error, got %q", err.Error()) } } + +func TestAppRunAcceptsSetupAndMcp(t *testing.T) { + app := NewApp() + + for _, command := range []string{"setup", "mcp"} { + t.Run(command, func(t *testing.T) { + if err := app.Run([]string{command}); err != nil { + t.Fatalf("expected %q to be accepted, got error: %v", command, err) + } + }) + } +}