[#1332] cli/playground: Add 'netmap-config' flag
All checks were successful
Tests and linters / Run gofumpt (push) Successful in 1m5s
Vulncheck / Vulncheck (push) Successful in 1m40s
Build / Build Components (push) Successful in 2m21s
Pre-commit hooks / Pre-commit (push) Successful in 2m20s
Tests and linters / Staticcheck (push) Successful in 3m18s
Tests and linters / Tests with -race (push) Successful in 3m25s
Tests and linters / Tests (push) Successful in 3m34s
Tests and linters / Lint (push) Successful in 3m46s
Tests and linters / gopls check (push) Successful in 4m37s
OCI image / Build container images (push) Successful in 5m8s

Change-Id: I4342fb9a6da2a05c18ae4e0ad9f0c71550efc5ef
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2025-04-09 16:31:48 +03:00 committed by Aleksandr Chuprov
parent 0d36e93169
commit 29b4fbe451

View file

@ -299,6 +299,11 @@ func (repl *policyPlaygroundREPL) run() error {
}
}
if len(viper.GetString(netmapConfigPath)) > 0 {
err := repl.handleLoad([]string{viper.GetString(netmapConfigPath)})
commonCmd.ExitOnErr(repl.cmd, "load netmap config error: %w", err)
}
var cfgCompleter []readline.PrefixCompleterInterface
var helpSubItems []readline.PrefixCompleterInterface
@ -354,6 +359,14 @@ If a wallet and endpoint is provided, the initial netmap data will be loaded fro
},
}
const (
netmapConfigPath = "netmap-config"
netmapConfigUsage = "Path to the netmap configuration file"
)
func initContainerPolicyPlaygroundCmd() {
commonflags.Init(policyPlaygroundCmd)
policyPlaygroundCmd.Flags().String(netmapConfigPath, "", netmapConfigUsage)
_ = viper.BindPFlag(netmapConfigPath, policyPlaygroundCmd.Flags().Lookup(netmapConfigPath))
}