From 8e4318dc304d318eb146f8e27b2a939b8599cba6 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Tue, 4 Jul 2023 16:03:02 +0300 Subject: [PATCH] accepts -i for interactive. arguments are mandatory --- cmd/config/init/flags.go | 2 +- cmd/config/init/init.go | 8 -------- cmd/config/init/interactive.go | 5 +++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cmd/config/init/flags.go b/cmd/config/init/flags.go index be4e99cc..ba660ee9 100644 --- a/cmd/config/init/flags.go +++ b/cmd/config/init/flags.go @@ -18,7 +18,7 @@ func addFlags(cmd *cobra.Command) error { cmd.Flags().StringP(FlagNames.HubID, "", StagingHubID, fmt.Sprintf("The ID of the Dymension hub. %s", getAvailableHubsMessage())) cmd.Flags().StringP(FlagNames.RollappBinary, "", consts.Executables.RollappEVM, "The rollapp binary. Should be passed only if you built a custom rollapp") cmd.Flags().StringP(FlagNames.TokenSupply, "", defaultTokenSupply, "The total token supply of the RollApp") - cmd.Flags().BoolP(FlagNames.Interactive, "", false, "Run roller in interactive mode") + cmd.Flags().BoolP(FlagNames.Interactive, "i", false, "Run roller in interactive mode") cmd.Flags().UintP(FlagNames.Decimals, "", 18, "The precision level of the RollApp's token defined by the number of decimal places. "+ "It should be an integer ranging between 1 and 18. This is akin to how 1 Ether equates to 10^18 Wei in Ethereum. "+ diff --git a/cmd/config/init/init.go b/cmd/config/init/init.go index 97d5438b..26cd8412 100644 --- a/cmd/config/init/init.go +++ b/cmd/config/init/init.go @@ -23,14 +23,6 @@ func InitCmd() *cobra.Command { return nil } - if len(args) == 0 { - fmt.Println("No arguments provided. Running in interactive mode.") - if err := cmd.Flags().Set(FlagNames.Interactive, "true"); err != nil { - return err - } - return nil - } - if len(args) < 2 { return fmt.Errorf("invalid number of arguments. Expected 2, got %d", len(args)) } diff --git a/cmd/config/init/interactive.go b/cmd/config/init/interactive.go index ebeb92c8..60d79b46 100644 --- a/cmd/config/init/interactive.go +++ b/cmd/config/init/interactive.go @@ -36,8 +36,9 @@ func RunInteractiveMode(cfg *config.RollappConfig) { } promptDenom := promptui.Prompt{ - Label: "Specify your RollApp denom", - Default: "RAX", + Label: "Specify your RollApp denom", + Default: "RAX", + AllowEdit: true, Validate: func(s string) error { if !config.IsValidTokenSymbol(s) { return fmt.Errorf("invalid token symbol")