feat: domain/storage/billing/config cmds + rainyun domain/storage/billing services
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var billingCmd = &cobra.Command{
|
||||
Use: "billing",
|
||||
Short: "Billing and orders",
|
||||
}
|
||||
|
||||
var ordersCmd = &cobra.Command{
|
||||
Use: "orders",
|
||||
Short: "List orders",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
svc := prov.Billing()
|
||||
if svc == nil {
|
||||
return fmt.Errorf("billing not supported by current provider")
|
||||
}
|
||||
orders, err := svc.Orders(cmd.Context())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return out.Print(orders)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
billingCmd.AddCommand(ordersCmd)
|
||||
rootCmd.AddCommand(billingCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user