NewExperimentsListSubcommand creates the experiments list subcommand.
()
| 126 | |
| 127 | // NewExperimentsListSubcommand creates the experiments list subcommand. |
| 128 | func NewExperimentsListSubcommand() *cobra.Command { |
| 129 | cmd := &cobra.Command{ |
| 130 | Use: "list", |
| 131 | Short: "List all experiment workflow branches", |
| 132 | Long: `List all experiment workflow branches in the repository. |
| 133 | |
| 134 | Reads the state.json file from each experiments/* branch and shows a summary |
| 135 | of each workflow's A/B experiments: number of experiments defined, total runs, |
| 136 | and timestamp of the most recent run.`, |
| 137 | Example: ` ` + string(constants.CLIExtensionPrefix) + ` experiments list # List all experiments |
| 138 | ` + string(constants.CLIExtensionPrefix) + ` experiments list --json # Output in JSON format |
| 139 | ` + string(constants.CLIExtensionPrefix) + ` experiments list --repo owner/repo # List from a specific repository`, |
| 140 | RunE: func(cmd *cobra.Command, args []string) error { |
| 141 | jsonOutput, _ := cmd.Flags().GetBool("json") |
| 142 | repoOverride, _ := cmd.Flags().GetString("repo") |
| 143 | return RunExperimentsList(ExperimentsListConfig{ |
| 144 | RepoOverride: repoOverride, |
| 145 | JSONOutput: jsonOutput, |
| 146 | }) |
| 147 | }, |
| 148 | } |
| 149 | |
| 150 | addJSONFlag(cmd) |
| 151 | addRepoFlag(cmd) |
| 152 | |
| 153 | return cmd |
| 154 | } |
| 155 | |
| 156 | // NewExperimentsAnalyzeSubcommand creates the experiments analyze subcommand. |
| 157 | func NewExperimentsAnalyzeSubcommand() *cobra.Command { |