Skip to content

Commit 81026a0

Browse files
authored
[cli/package] Use --output=markdown in package-add docs hint (#23098)
The `--format` flag on `pulumi api` was renamed to `--output` in #23072. The post-install docs hint printed by `pulumi package add` and `pulumi package gen-sdk` was missed in that rename, so it still emits `pulumi api --format=markdown`. Against the renamed command the hint fails with `unknown flag: --format`. Update the format string in `printRegistryDocsHint` and the matching expected output in `TestPrintRegistryDocsHint`. ## Test plan - `cd pkg && go test -run TestPrintRegistryDocsHint ./cmd/pulumi/packagecmd/...` passes; the `agent_on,_happy_path` subtest asserts the full expected hint output.
1 parent 69d216c commit 81026a0

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changes:
2+
- type: fix
3+
scope: cli/package
4+
description: Use `--output=markdown` (not the renamed-away `--format=markdown`) in the `pulumi api` pointers printed by `pulumi package add` and `pulumi package gen-sdk`

‎pkg/cmd/pulumi/packagecmd/package_add.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func printRegistryDocsHint(
254254
}
255255
fmt.Fprintln(w, "Documentation:")
256256
for _, h := range hints {
257-
fmt.Fprintf(w, " pulumi api --format=markdown '%s%s'%s\n", base, h.suffix, h.comment)
257+
fmt.Fprintf(w, " pulumi api --output=markdown '%s%s'%s\n", base, h.suffix, h.comment)
258258
}
259259
}
260260

@@ -293,7 +293,8 @@ func loadEnclosingTarget(ctx context.Context, wd string) (addTarget, error) {
293293
// Cloud registry is linked to a backend, but we don't have one
294294
// available in a plugin. Use the default backend.
295295
reg: cmdCmd.NewDefaultRegistry(
296-
ctx, cmdBackend.DefaultLoginManager, pkgWorkspace.Instance, nil, cmdutil.Diag(), env.Global()),
296+
ctx, cmdBackend.DefaultLoginManager, pkgWorkspace.Instance, nil, cmdutil.Diag(), env.Global(),
297+
),
297298
}, nil
298299
default:
299300
panic(fmt.Sprintf("workspace.LoadBaseProjectFrom promises that it will return "+

‎pkg/cmd/pulumi/packagecmd/package_add_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func TestPrintRegistryDocsHint(t *testing.T) {
243243

244244
expectedBase := "/api/registry/packages/pulumi/pulumi/random/versions/4.19.1"
245245
cmdLine := func(suffix, comment string) string {
246-
return " pulumi api --format=markdown '" + expectedBase + suffix + "'" + comment + "\n"
246+
return " pulumi api --output=markdown '" + expectedBase + suffix + "'" + comment + "\n"
247247
}
248248
expectedOutput := "Documentation:\n" +
249249
cmdLine("/readme", " # package readme") +

0 commit comments

Comments
 (0)