Visitar URL original
Add a --version flag to the pulumi command by VenelinMartinov · Pull Request #23898 · pulumi/pulumi · GitHub
Skip to content

Add a --version flag to the pulumi command - #23898

Merged
VenelinMartinov merged 3 commits into
masterfrom
vvm/version-flag
Jul 14, 2026
Merged

VenelinMartinov merged 3 commits into
masterfrom
vvm/version-flag

Conversation

@VenelinMartinov

Copy link
Copy Markdown
Contributor

pulumi --version previously failed with "unknown flag"; the version was only available via the pulumi version subcommand. This wires up cobra's built-in version handling by setting the root command's Version field, with a version template so pulumi --version prints exactly the same output as pulumi version (just the version string).

Notes:

  • The persistent --verbose/-v shorthand is unaffected: cobra only claims -v for --version when the shorthand is free, so --version gets no shorthand.
  • Cobra handles --version before PersistentPreRunE, so pulumi --version skips the async update check that pulumi version triggers, which seems desirable for a plain version query.

🤖 Generated with Claude Code

VenelinMartinov and others added 2 commits July 13, 2026 13:06
Set the root command's Version field so cobra's built-in --version
handling kicks in, with a version template that prints exactly the same
output as `pulumi version`. The persistent --verbose/-v shorthand is
unaffected since cobra only claims -v when it is free.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VenelinMartinov
VenelinMartinov marked this pull request as ready for review July 13, 2026 10:09
@VenelinMartinov
VenelinMartinov requested a review from a team as a code owner July 13, 2026 10:09
Comment thread pkg/cmd/pulumi/pulumi.go Resolved
Comment thread pkg/cmd/pulumi/pulumi_test.go Resolved
The version flag test now runs against the actual built binary and
compares `pulumi --version` output with `pulumi version` instead of a
hardcoded value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VenelinMartinov
VenelinMartinov added this pull request to the merge queue Jul 13, 2026
@github-actions

Copy link
Copy Markdown

🚧 This PR was held out of the merge queue because a Pulumi release is in progress. The queue is temporarily closed to everything except the post-release changelog/go.mod update.

Wait for the in-progress release to finalize, then re-queue this PR.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 13, 2026
@VenelinMartinov
VenelinMartinov added this pull request to the merge queue Jul 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 13, 2026
@VenelinMartinov
VenelinMartinov added this pull request to the merge queue Jul 14, 2026
Merged via the queue into master with commit da11b64 Jul 14, 2026
128 checks passed
@VenelinMartinov
VenelinMartinov deleted the vvm/version-flag branch July 14, 2026 10:59
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.253.0.

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.

4 participants