Skip to content
Merged
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
10 changes: 5 additions & 5 deletions internal/cli/iam/projects/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/spf13/cobra"
)

var createTemplate = "Project '{{.ID}}' created.\n"
const atlasCreateTemplate = "Project '{{.ID}}' created.\n"

type CreateOpts struct {
cli.GlobalOpts
Expand All @@ -49,23 +49,23 @@ func (opts *CreateOpts) Run() error {
if err != nil {
return err
}
if config.Service() != config.CloudService {
createTemplate += "Agent API Key: '{{.AgentAPIKey}}'\n"
}

return opts.Print(r)
}

// mongocli iam project(s) create <name> [--orgId orgId].
func CreateBuilder() *cobra.Command {
opts := &CreateOpts{}
opts.Template = createTemplate
opts.Template = atlasCreateTemplate
cmd := &cobra.Command{
Use: "create <name>",
Short: "Create a project.",
Args: require.ExactArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error {
opts.OutWriter = cmd.OutOrStdout()
if config.Service() != config.CloudService {
opts.Template += "Agent API Key: '{{.AgentAPIKey}}'\n"
}
return opts.init()
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down