(deps commandDeps)
| 798 | } |
| 799 | |
| 800 | func newConfigApplyHistoryCommand(deps commandDeps) *cobra.Command { |
| 801 | var status string |
| 802 | var actor string |
| 803 | var limit int |
| 804 | cmd := &cobra.Command{ |
| 805 | Use: "apply-history", |
| 806 | Short: "List persisted config apply records", |
| 807 | Args: cobra.NoArgs, |
| 808 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 809 | client, err := clientFromDeps(deps) |
| 810 | if err != nil { |
| 811 | return fmt.Errorf("cli: create daemon client for config apply-history: %w", err) |
| 812 | } |
| 813 | history, err := client.ListSettingsApplyRecords(cmd.Context(), SettingsApplyHistoryQuery{ |
| 814 | Status: status, |
| 815 | Actor: actor, |
| 816 | Limit: limit, |
| 817 | }) |
| 818 | if err != nil { |
| 819 | return fmt.Errorf("cli: list config apply-history: %w", err) |
| 820 | } |
| 821 | return writeCommandOutput(cmd, configApplyHistoryBundle(history)) |
| 822 | }, |
| 823 | } |
| 824 | cmd.Flags().StringVar(&status, configStatusKey, "", "Filter by apply status") |
| 825 | cmd.Flags().StringVar(&actor, "actor", "", "Filter by apply actor") |
| 826 | cmd.Flags().IntVar(&limit, "limit", 50, "Maximum records to return") |
| 827 | return cmd |
| 828 | } |
| 829 | |
| 830 | func loadConfigForDisplay(deps commandDeps, workspaceRoot string) (aghconfig.Config, string, error) { |
| 831 | workspace, err := resolveOptionalConfigWorkspaceRoot(workspaceRoot) |
no test coverage detected