working commit

This commit is contained in:
2026-06-06 02:28:44 +02:00
parent 557aea269d
commit c96602e933
60 changed files with 2506 additions and 1273 deletions
+68
View File
@@ -0,0 +1,68 @@
/*
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
*/
package account
import (
"github.com/spf13/cobra"
)
type Util struct {
rootCmd *cobra.Command
createAccountParams createAccountParams
listAccountsParams listAccountsParams
updateAccountParams updateAccountParams
deleteAccountParams deleteAccountParams
}
func NewUtil() *Util {
return &Util{}
}
func (util *Util) GetRooCmd() *cobra.Command {
return util.rootCmd
}
func (util *Util) BuildCmds() *cobra.Command {
rootCmd := &cobra.Command{
Use: "account",
Short: "\nAccount operations",
SilenceUsage: true,
}
rootCmd.CompletionOptions.DisableDefaultCmd = true
var createAccountCmd = &cobra.Command{
Use: "create name password ",
Short: "Create account",
Args: cobra.ExactArgs(2),
Run: util.CreateAccount,
}
rootCmd.AddCommand(createAccountCmd)
var listAccountsCmd = &cobra.Command{
Use: "list",
Short: "List accounts",
Run: util.ListAccounts,
}
rootCmd.AddCommand(listAccountsCmd)
var updateAccountsCmd = &cobra.Command{
Use: "update name|id",
Short: "Update account",
Args: cobra.ExactArgs(1),
Run: util.UpdateAccount,
}
rootCmd.AddCommand(updateAccountsCmd)
var deleteAccountCmd = &cobra.Command{
Use: "delete name|id",
Short: "Delete account",
Args: cobra.ExactArgs(1),
Run: util.DeleteAccount,
}
rootCmd.AddCommand(deleteAccountCmd)
util.rootCmd = rootCmd
return util.rootCmd
}