()
| 105 | } |
| 106 | |
| 107 | func setAppDefaultCmd() *cobra.Command { |
| 108 | return &cobra.Command{ |
| 109 | Use: "default [app-name]", |
| 110 | Short: "Set an application as the default", |
| 111 | Long: heredoc.Doc(` |
| 112 | Set an application as the default which will be used |
| 113 | for all further operations unless specified otherwise. |
| 114 | `), |
| 115 | Example: heredoc.Doc(` |
| 116 | # Set an application as the default |
| 117 | $ stream-cli config default staging |
| 118 | |
| 119 | # All underlying operations will use it if not specified otherwise |
| 120 | $ stream-cli chat get-app |
| 121 | # Prints the settings of staging app |
| 122 | |
| 123 | # Specifying other apps during an operation |
| 124 | $ stream-cli chat get-app --app prod |
| 125 | # Prints the settings of prod app |
| 126 | `), |
| 127 | Args: cobra.ExactArgs(1), |
| 128 | RunE: func(cmd *cobra.Command, args []string) error { |
| 129 | config := cfg.GetConfig(cmd) |
| 130 | return config.SetDefault(args[0]) |
| 131 | }, |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | func runQuestionnaire(cmd *cobra.Command) error { |
| 136 | var newAppConfig cfg.App |
no test coverage detected