Skip to content

Commit

Permalink
restored create cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket-0510 committed Feb 20, 2024
1 parent a3f6e06 commit 195733f
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,8 @@ func newCreateConfig(cmd *cobra.Command, args []string, newClient ClientFactory)
dirName string
absolutePath string
)
client, done := newClient(ClientConfig{Verbose: cfg.Verbose})
defer done()

// IN confirm mode. If also in an interactive terminal, run prompts.
if len(args)<1 {
createdCfg, err := cfg.prompt(client)
if err != nil {
return createdCfg, err
}
fmt.Println("Command:")
fmt.Println(singleCommand(cmd, args, createdCfg))
return createdCfg, nil
}else {
if len(args) >= 1 {
path = args[0]
}

Expand All @@ -217,6 +206,20 @@ func newCreateConfig(cmd *cobra.Command, args []string, newClient ClientFactory)

// Create a tempoarary client for use by the following prompts to complete
// runtime/template suggestions etc
client, done := newClient(ClientConfig{Verbose: cfg.Verbose})
defer done()

// IN confirm mode. If also in an interactive terminal, run prompts.
if interactiveTerminal() {
createdCfg, err := cfg.prompt(client)
if err != nil {
return createdCfg, err
}
fmt.Println("Command:")
fmt.Println(singleCommand(cmd, args, createdCfg))
return createdCfg, nil
}

// Confirming, but noninteractive
// Print out the final values as a confirmation. Only show Repository or
// Repositories, not both (repository takes precedence) in order to avoid
Expand Down Expand Up @@ -565,4 +568,4 @@ func RuntimeTemplateOptions(client *fn.Client) (string, error) {
}
writer.Flush()
return builder.String(), nil
}
}

Check failure on line 571 in cmd/create.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

[EOF Newline] reported by reviewdog 🐶 Missing newline Raw Output: cmd/create.go:571: Missing newline

0 comments on commit 195733f

Please sign in to comment.