From 629f4353c5047dc84aee5460bf934fc88dacdeb2 Mon Sep 17 00:00:00 2001 From: mahiro72 Date: Sat, 15 Jun 2024 15:33:29 +0900 Subject: [PATCH 1/4] add: add `interchaintest add-contract --package `options --- cmd/constants.go | 1 + cmd/root_cmd.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/constants.go b/cmd/constants.go index 36e488f..43e31c6 100644 --- a/cmd/constants.go +++ b/cmd/constants.go @@ -7,6 +7,7 @@ const ( YesFlag = "yes" SuiteDirFlag = "suite-dir" ContractNameFlag = "contract-name" + PackageFlag = "package" MessagesOnlyFlag = "messages-only" DebugFlag = "debug" diff --git a/cmd/root_cmd.go b/cmd/root_cmd.go index ec2509d..c3e92e5 100644 --- a/cmd/root_cmd.go +++ b/cmd/root_cmd.go @@ -298,6 +298,12 @@ func ictestAddContract() *cobra.Command { if err != nil { return err } + if packageName == "" { + packageName, err = cmd.Flags().GetString(PackageFlag) + if err != nil { + return err + } + } err = interchaintest.AddContract(args[0], suiteDir, packageName) if err != nil { @@ -311,6 +317,8 @@ func ictestAddContract() *cobra.Command { cmd.Flags().String(SuiteDirFlag, ".", "Path to the test suite directory. If not provided, the current working directory will be used.") cmd.Flags().String(ContractNameFlag, "", "Name of the contract to be added to the test suite. If not provided, the contract name will be inferred from the schema file.") + cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package instead") + cmd.Flags().StringP(PackageFlag, "p", "", "Package name for the generated contract code. If not provided, the contract name will be inferred from the schema file.") return cmd } From 3dbc3b658472c3ab1de43841c048413879807691 Mon Sep 17 00:00:00 2001 From: mahiro72 Date: Tue, 18 Jun 2024 00:10:30 +0900 Subject: [PATCH 2/4] del: const PackageName --- cmd/constants.go | 1 - cmd/root_cmd.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/constants.go b/cmd/constants.go index 43e31c6..36e488f 100644 --- a/cmd/constants.go +++ b/cmd/constants.go @@ -7,7 +7,6 @@ const ( YesFlag = "yes" SuiteDirFlag = "suite-dir" ContractNameFlag = "contract-name" - PackageFlag = "package" MessagesOnlyFlag = "messages-only" DebugFlag = "debug" diff --git a/cmd/root_cmd.go b/cmd/root_cmd.go index c3e92e5..8f8895d 100644 --- a/cmd/root_cmd.go +++ b/cmd/root_cmd.go @@ -299,7 +299,7 @@ func ictestAddContract() *cobra.Command { return err } if packageName == "" { - packageName, err = cmd.Flags().GetString(PackageFlag) + packageName, err = cmd.Flags().GetString(PackageNameFlag) if err != nil { return err } @@ -318,7 +318,7 @@ func ictestAddContract() *cobra.Command { cmd.Flags().String(SuiteDirFlag, ".", "Path to the test suite directory. If not provided, the current working directory will be used.") cmd.Flags().String(ContractNameFlag, "", "Name of the contract to be added to the test suite. If not provided, the contract name will be inferred from the schema file.") cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package instead") - cmd.Flags().StringP(PackageFlag, "p", "", "Package name for the generated contract code. If not provided, the contract name will be inferred from the schema file.") + cmd.Flags().StringP(PackageNameFlag, "p", "", "Package name for the generated contract code. If not provided, the contract name will be inferred from the schema file.") return cmd } From 7b0585b0f229436fb46203c877ac7510daa62187 Mon Sep 17 00:00:00 2001 From: mahiro72 Date: Tue, 18 Jun 2024 00:15:40 +0900 Subject: [PATCH 3/4] fix: deprecated message --- cmd/root_cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/root_cmd.go b/cmd/root_cmd.go index 8f8895d..304ab0e 100644 --- a/cmd/root_cmd.go +++ b/cmd/root_cmd.go @@ -317,7 +317,7 @@ func ictestAddContract() *cobra.Command { cmd.Flags().String(SuiteDirFlag, ".", "Path to the test suite directory. If not provided, the current working directory will be used.") cmd.Flags().String(ContractNameFlag, "", "Name of the contract to be added to the test suite. If not provided, the contract name will be inferred from the schema file.") - cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package instead") + cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package-name instead") cmd.Flags().StringP(PackageNameFlag, "p", "", "Package name for the generated contract code. If not provided, the contract name will be inferred from the schema file.") return cmd From 0f51bf03d8a8545f503657334356a239a4b794a8 Mon Sep 17 00:00:00 2001 From: srdtrk Date: Tue, 18 Jun 2024 14:04:16 +0400 Subject: [PATCH 4/4] lint: fix linter compaint --- cmd/root_cmd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/root_cmd.go b/cmd/root_cmd.go index 304ab0e..66221cd 100644 --- a/cmd/root_cmd.go +++ b/cmd/root_cmd.go @@ -317,7 +317,10 @@ func ictestAddContract() *cobra.Command { cmd.Flags().String(SuiteDirFlag, ".", "Path to the test suite directory. If not provided, the current working directory will be used.") cmd.Flags().String(ContractNameFlag, "", "Name of the contract to be added to the test suite. If not provided, the contract name will be inferred from the schema file.") - cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package-name instead") + err := cmd.Flags().MarkDeprecated(ContractNameFlag, "please use --package-name instead") + if err != nil { + panic(err) + } cmd.Flags().StringP(PackageNameFlag, "p", "", "Package name for the generated contract code. If not provided, the contract name will be inferred from the schema file.") return cmd