ente/cmd/account.go

41 lines
871 B
Go
Raw Normal View History

2023-09-14 04:20:32 +00:00
package cmd
import (
"context"
"github.com/spf13/cobra"
)
// Define the 'account' command and its subcommands
var accountCmd = &cobra.Command{
Use: "account",
Short: "Manage account settings",
}
// Subcommand for 'account list'
var listAccCmd = &cobra.Command{
Use: "list",
Short: "list configured accounts",
RunE: func(cmd *cobra.Command, args []string) error {
2023-09-21 09:53:37 +00:00
recoverWithLog()
2023-09-14 04:20:32 +00:00
return ctrl.ListAccounts(context.Background())
},
}
// Subcommand for 'account add'
var addAccCmd = &cobra.Command{
Use: "add",
Short: "Add a new account",
Run: func(cmd *cobra.Command, args []string) {
2023-09-21 09:53:37 +00:00
recoverWithLog()
2023-09-14 04:20:32 +00:00
ctrl.AddAccount(context.Background())
},
}
func init() {
// Add 'config' subcommands to the root command
rootCmd.AddCommand(accountCmd)
// Add 'config' subcommands to the 'config' command
accountCmd.AddCommand(listAccCmd, addAccCmd)
}