(f factory.Factory)
| 59 | } |
| 60 | |
| 61 | func NewCmdClone(f factory.Factory) *cobra.Command { |
| 62 | cloneFlags := NewCloneFlags() |
| 63 | cmd := &cobra.Command{ |
| 64 | Use: "clone", |
| 65 | Short: "Clone a tenant", |
| 66 | Long: "Clone a tenant in Octopus Deploy", |
| 67 | Example: heredoc.Docf(` |
| 68 | %[1]s tenant clone |
| 69 | %[1]s tenant clone --name "Gary's Cakes" --source-tenant "Bob's Wood Shop" |
| 70 | `, constants.ExecutableName), |
| 71 | RunE: func(c *cobra.Command, args []string) error { |
| 72 | opts := NewCloneOptions(cloneFlags, cmd.NewDependencies(f, c)) |
| 73 | |
| 74 | return cloneRun(opts) |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | flags := cmd.Flags() |
| 79 | flags.StringVarP(&cloneFlags.Name.Value, cloneFlags.Name.Name, "n", "", "Name of the new tenant") |
| 80 | flags.StringVarP(&cloneFlags.Description.Value, cloneFlags.Description.Name, "d", "", "Description of the new tenant") |
| 81 | flags.StringVar(&cloneFlags.SourceTenant.Value, cloneFlags.SourceTenant.Name, "", "Name of the source tenant") |
| 82 | return cmd |
| 83 | } |
| 84 | |
| 85 | func cloneRun(opts *CloneOptions) error { |
| 86 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected