| 536 | } |
| 537 | |
| 538 | func (c *cli) rulePickerOptions(ctx context.Context) (pickerOptions, error) { |
| 539 | list, err := c.api.Rule.List(ctx) |
| 540 | if err != nil { |
| 541 | return nil, err |
| 542 | } |
| 543 | |
| 544 | var opts pickerOptions |
| 545 | for _, r := range list.Rules { |
| 546 | opts = append(opts, pickerOption{value: r.GetID(), label: r.GetName()}) |
| 547 | } |
| 548 | |
| 549 | if len(opts) == 0 { |
| 550 | return nil, errors.New("there are currently no rules to choose from") |
| 551 | } |
| 552 | |
| 553 | return opts, nil |
| 554 | } |
| 555 | |
| 556 | func (c *cli) ruleEditorHint() { |
| 557 | c.renderer.Infof("%s Once you close the editor, the rule will be saved. To cancel, press CTRL+C.", ansi.Faint("Hint:")) |