Skip to content

Commit 9b8de46

Browse files
authored
fix: fix project creation template (#704)
1 parent ffbfa2d commit 9b8de46

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/cli/iam/projects/create.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/spf13/cobra"
2525
)
2626

27-
var createTemplate = "Project '{{.ID}}' created.\n"
27+
const atlasCreateTemplate = "Project '{{.ID}}' created.\n"
2828

2929
type CreateOpts struct {
3030
cli.GlobalOpts
@@ -49,23 +49,23 @@ func (opts *CreateOpts) Run() error {
4949
if err != nil {
5050
return err
5151
}
52-
if config.Service() != config.CloudService {
53-
createTemplate += "Agent API Key: '{{.AgentAPIKey}}'\n"
54-
}
5552

5653
return opts.Print(r)
5754
}
5855

5956
// mongocli iam project(s) create <name> [--orgId orgId].
6057
func CreateBuilder() *cobra.Command {
6158
opts := &CreateOpts{}
62-
opts.Template = createTemplate
59+
opts.Template = atlasCreateTemplate
6360
cmd := &cobra.Command{
6461
Use: "create <name>",
6562
Short: "Create a project.",
6663
Args: require.ExactArgs(1),
6764
PreRunE: func(cmd *cobra.Command, args []string) error {
6865
opts.OutWriter = cmd.OutOrStdout()
66+
if config.Service() != config.CloudService {
67+
opts.Template += "Agent API Key: '{{.AgentAPIKey}}'\n"
68+
}
6969
return opts.init()
7070
},
7171
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)