mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
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()).
35 lines
745 B
Go
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)
|
|
},
|
|
}
|
|
}
|