Files
base/cmd/cli/crons.go
zeekay 9fbfc287eb cli: first-class base CLI subcommands inherited by all Base daemons
Adds collection/record/login/whoami/crons + daemon lifecycle +
cluster (base-ha HA) + operator (K8s CRD) + config/status/self/rpc.
Lux/cli network flags (--mainnet/--testnet/--devnet/--dev).

All Base daemons (atsd-style binaries) get the full CLI for free
via base.Start() or manual cmd.AddCommand(cmd.NewCLICommand()).
2026-04-13 13:29:39 -07:00

35 lines
745 B
Go

package cli
import (
"os"
"github.com/spf13/cobra"
)
// NewCronsCommand returns the `crons` subcommand tree.
func NewCronsCommand(clientFn func() *Client, formatFn func() Format) *cobra.Command {
cmd := &cobra.Command{
Use: "crons",
Short: "Manage cron schedules",
}
cmd.AddCommand(cronsListCmd(clientFn, formatFn))
return cmd
}
func cronsListCmd(clientFn func() *Client, formatFn func() Format) *cobra.Command {
return &cobra.Command{
Use: "list",
Short: "List registered cron schedules",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
data, _, err := clientFn().Get("/crons")
if err != nil {
return err
}
return Print(os.Stdout, formatFn(), data)
},
}
}