From 984c7942e7393e5237f82185252a90af93b46cff Mon Sep 17 00:00:00 2001 From: mahiro <70263039+mahiro72@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:26:03 +0900 Subject: [PATCH] imp: `--package-name` flag in 'interchaintest add-contract' (#90) * add: add `interchaintest add-contract --package `options * del: const PackageName * fix: deprecated message * lint: fix linter compaint --------- Co-authored-by: srdtrk --- cmd/root_cmd.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/root_cmd.go b/cmd/root_cmd.go index ec2509d..66221cd 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(PackageNameFlag) + if err != nil { + return err + } + } err = interchaintest.AddContract(args[0], suiteDir, packageName) if err != nil { @@ -311,6 +317,11 @@ 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.") + 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 }