Skip to content

Commit

Permalink
imp: --package-name flag in 'interchaintest add-contract' (#90)
Browse files Browse the repository at this point in the history
* add: add `interchaintest add-contract --package <package name> `options

* del: const PackageName

* fix: deprecated message

* lint: fix linter compaint

---------

Co-authored-by: srdtrk <[email protected]>
  • Loading branch information
mahiro72 and srdtrk authored Jun 18, 2024
1 parent 075a705 commit 984c794
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/root_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

0 comments on commit 984c794

Please sign in to comment.