Skip to content

Pass args to root.Execute explicitly - #7486

Open
pietern wants to merge 1 commit into
sync-options-valuesfrom
execute-args
Open

pietern wants to merge 1 commit into
sync-options-valuesfrom
execute-args

Conversation

@pietern

@pietern pietern commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Changes

root.Execute now takes the args to run instead of reading them from the command, where cobra falls back to os.Args if they were never set. nil means no arguments. main passes os.Args[1:], and tests pass their args directly instead of calling SetArgs first.

The next PR needs this: it has to see the args before cobra runs.

Tests

New unit test TestExecuteWithNilArgsRunsWithoutArgs checks that nil means no arguments; existing unit and acceptance tests cover the callers.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 70068a7a7 | Workflow run

Regression test report

Selected 2 changed tests (limit=20, 0 not selected)

2 tests: regression=0 unreleased=0 coverage=2 failing=0
test branch main (eef3b54) latest (v1.26.0)
TestAccept/cmd/sync-wrong-args ✅ ✅ ✅
TestAccept/cmd/sync/dryrun ✅ ✅ ✅

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 70068a7

Run: 43421191245

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 17 9:16
💚​ aws-windows-latest-4core-16gb 1 272 15 5:14
💚​ azure linux-2core-8gb 1 269 17 8:26
💚​ azure-windows-latest-4core-16gb 1 271 15 4:48
💚​ gcp linux-2core-8gb 1 270 17 8:13
💚​ gcp-windows-latest-4core-16gb 1 272 15 6:00
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:26 aws linux-2core-8gb TestAccept
4:05 azure linux-2core-8gb TestAccept
4:01 azure-windows-latest-4core-16gb TestAccept
3:54 gcp linux-2core-8gb TestAccept
3:43 gcp-windows-latest-4core-16gb TestAccept
3:04 aws-windows-latest-4core-16gb TestAccept

@pietern
pietern force-pushed the execute-args branch 3 times, most recently from d823fdf to 6426811 Compare November 12, 2026 13:51
Lets Execute resolve the target command before running cobra, which
lazily added subcommands need. nil args now mean no arguments instead
of falling back to the process arguments.

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants