[#1301] adm/morph: Support global domain

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-08-08 12:47:01 +03:00
parent 94f07b4778
commit 4da6493654
3 changed files with 22 additions and 2 deletions

View file

@ -6,10 +6,17 @@ import (
"github.com/spf13/cobra"
)
const (
longFormat = "long"
longFormatShort = "l"
longFormatDesc = "Includes additional information about global domains."
)
func initTokensCmd() {
Cmd.AddCommand(tokensCmd)
tokensCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
tokensCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
tokensCmd.Flags().BoolP(longFormat, longFormatShort, false, longFormatDesc)
Cmd.AddCommand(tokensCmd)
}
func listTokens(cmd *cobra.Command, _ []string) {
@ -18,7 +25,17 @@ func listTokens(cmd *cobra.Command, _ []string) {
commonCmd.ExitOnErr(cmd, "unable to get tokens: %w", err)
for toks, err := it.Next(10); err == nil && len(toks) > 0; toks, err = it.Next(10) {
for _, token := range toks {
cmd.Println(string(token))
info := ""
if longFlag, err := cmd.Flags().GetBool(longFormat); err == nil && longFlag {
info, err = c.GlobalDomainInfo(string(token))
commonCmd.ExitOnErr(cmd, "unable to get global domain info: %w", err)
}
if info == "" {
cmd.Println(string(token))
} else {
cmd.Println(string(token), "(", info, ")")
}
}
}
}

3
go.mod
View file

@ -129,3 +129,6 @@ require (
)
replace github.com/nspcc-dev/neo-go => git.frostfs.info/TrueCloudLab/neoneo-go v0.106.1-0.20240611123832-594f716b3d18
//replace git.frostfs.info/TrueCloudLab/frostfs-contract => /home/achuprov/Documents/work/frostfs-contract
replace git.frostfs.info/TrueCloudLab/frostfs-contract => git.frostfs.info/achuprov/frostfs-contract v0.18.1-0.20240808092722-b58602917706

BIN
go.sum

Binary file not shown.