-
Notifications
You must be signed in to change notification settings - Fork 23
/
channel_create.go
34 lines (27 loc) · 1.12 KB
/
channel_create.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cmd
import (
"github.com/replicatedhq/replicated/cli/print"
"github.com/spf13/cobra"
)
func (r *runners) InitChannelCreate(parent *cobra.Command) {
cmd := &cobra.Command{
Use: "create",
Short: "Create a new channel in your app",
Long: `Create a new channel in your app and print the channel on success.
Example:
replicated channel create --name Beta --description 'New features subject to change'`,
}
cmd.Hidden = true // Not supported in KOTS
parent.AddCommand(cmd)
cmd.Flags().StringVar(&r.args.channelCreateName, "name", "", "The name of this channel")
cmd.Flags().StringVar(&r.args.channelCreateDescription, "description", "", "A longer description of this channel")
cmd.Flags().StringVar(&r.outputFormat, "output", "table", "The output format to use. One of: json|table (default: table)")
cmd.RunE = r.channelCreate
}
func (r *runners) channelCreate(cmd *cobra.Command, args []string) error {
allChannels, err := r.api.CreateChannel(r.appID, r.appType, r.args.channelCreateName, r.args.channelCreateDescription)
if err != nil {
return err
}
return print.Channels(r.outputFormat, r.w, allChannels)
}