Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cli/dispatcher/internal/dispatcher/dispatcher_v2_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ func dispatcherV2ProjectDetectedError(projectRoot string, v2Project dispatcherV2
}
}

// dispatcherV2ModeNotice builds the stderr notice announcing delegation to the V2 CLI.
// Why: delegation happens implicitly, so the executed CLI generation and version are otherwise invisible to the caller.
func dispatcherV2ModeNotice(version string) string {
return "uloop: executing in V2 mode (" + dispatcherV2CLIPackageName + "@" + version + ")\n"
}

// runDispatcherV2CLI installs and executes the V2 CLI while preserving the original command arguments.
// Why: the dispatcher must select the CLI generation before command parsing can change user-supplied arguments.
func runDispatcherV2CLI(ctx context.Context, version string, args []string, stdout io.Writer, stderr io.Writer) (int, error) {
Expand All @@ -106,7 +112,7 @@ func runDispatcherV2CLI(ctx context.Context, version string, args []string, stdo
if err != nil {
return 0, err
}
_, err = io.WriteString(stderr, "uloop: executing in V2 mode\n")
_, err = io.WriteString(stderr, dispatcherV2ModeNotice(version))
if err != nil {
return 0, err
}
Expand Down
13 changes: 13 additions & 0 deletions cli/dispatcher/internal/dispatcher/dispatcher_v2_run_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dispatcher

import "testing"

func TestDispatcherV2ModeNoticeReportsDelegatedPackageAndVersion(t *testing.T) {
// Verifies the notice names the delegated V2 CLI package and its version so the caller can identify the executed generation.
notice := dispatcherV2ModeNotice("2.2.0")

want := "uloop: executing in V2 mode (" + dispatcherV2CLIPackageName + "@2.2.0)\n"
if notice != want {
t.Fatalf("notice = %q, want %q", notice, want)
}
}
Loading