Skip to content

Commit

Permalink
feat: Add CLI to group module (#10663)
Browse files Browse the repository at this point in the history
## Description

Closes: #9899



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
blushi authored Dec 15, 2021
1 parent 675be9d commit 914af60
Show file tree
Hide file tree
Showing 10 changed files with 3,515 additions and 31 deletions.
440 changes: 440 additions & 0 deletions x/group/client/cli/query.go

Large diffs are not rendered by default.

650 changes: 650 additions & 0 deletions x/group/client/cli/tx.go

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions x/group/client/cli/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package cli

import (
"io/ioutil"

"github.com/cosmos/cosmos-sdk/client"

"github.com/cosmos/cosmos-sdk/x/group"
)

func parseMembers(clientCtx client.Context, membersFile string) ([]group.Member, error) {
members := group.Members{}

if membersFile == "" {
return members.Members, nil
}

contents, err := ioutil.ReadFile(membersFile)
if err != nil {
return nil, err
}

err = clientCtx.Codec.UnmarshalJSON(contents, &members)
if err != nil {
return nil, err
}

return members.Members, nil
}

func execFromString(execStr string) group.Exec {
exec := group.Exec_EXEC_UNSPECIFIED
switch execStr {
case ExecTry:
exec = group.Exec_EXEC_TRY
}
return exec
}
18 changes: 18 additions & 0 deletions x/group/client/testutil/cli_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//go:build norace
// +build norace

package testutil

import (
"testing"

"github.com/cosmos/cosmos-sdk/testutil/network"

"github.com/stretchr/testify/suite"
)

func TestIntegrationTestSuite(t *testing.T) {
cfg := network.DefaultConfig()
cfg.NumValidators = 2
suite.Run(t, NewIntegrationTestSuite(cfg))
}
Loading

0 comments on commit 914af60

Please sign in to comment.