MCPcopy Create free account
hub / github.com/GetStream/stream-cli / getCmd

Function getCmd

pkg/cmd/chat/channeltype/channeltype.go:24–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24func getCmd() *cobra.Command {
25 cmd := &cobra.Command{
26 Use: "get-channel-type [channel-type] --output-format [json|tree]",
27 Short: "Get channel type",
28 Example: heredoc.Doc(`
29 # Returns a channel type and prints it as JSON
30 $ stream-cli chat get-channel-type livestream
31
32 # Returns a channel type and prints it as a browsable tree
33 $ stream-cli chat get-channel-type messaging --output-format tree
34 `),
35 Args: cobra.ExactArgs(1),
36 RunE: func(cmd *cobra.Command, args []string) error {
37 c, err := config.GetConfig(cmd).GetClient(cmd)
38 if err != nil {
39 return err
40 }
41
42 ct := args[0]
43
44 resp, err := c.GetChannelType(cmd.Context(), ct)
45 if err != nil {
46 return err
47 }
48
49 return utils.PrintObject(cmd, resp)
50 },
51 }
52
53 fl := cmd.Flags()
54 fl.StringP("output-format", "o", "json", "[optional] Output format. Can be json or tree")
55
56 return cmd
57}
58
59func createCmd() *cobra.Command {
60 cmd := &cobra.Command{

Callers 1

NewCmdsFunction · 0.70

Calls 3

GetConfigFunction · 0.92
PrintObjectFunction · 0.92
GetClientMethod · 0.80

Tested by

no test coverage detected