Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change transaction list status default #8

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd_query_multisig_transaction_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (cmd *cmdQueryMultiSigTransactionList) Setup(params clingy.Parameters) {
cmd.caller.setup(params)
cmd.pending = toggleFlag(params, "pending", "List pending transactions", true)
cmd.executed = toggleFlag(params, "executed", "List executed transactions", false)
cmd.status = boolFlag(params, "status", "Show the transaction status")
cmd.status = !boolFlag(params, "short", "Only show transaction numbers")
}

func (cmd *cmdQueryMultiSigTransactionList) Execute(ctx context.Context) error {
Expand Down
16 changes: 8 additions & 8 deletions cmd_query_multisig_transaction_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ func TestQueryMultiSigTransactionListCmd(t *testing.T) {
return requireCmdSuccess(t, harness, append(args, flags...)...)
}

assert.Empty(t, list("--pending=false", "--executed=false"))
assert.Empty(t, list("--pending=false", "--executed=true"))
assert.Equal(t, "0\n", list("--pending=true", "--executed=false"))
assert.Equal(t, expectedPending, list("--pending=true", "--executed=false", "--status"))
assert.Empty(t, list("--pending=false", "--executed=false", "--short"))
assert.Empty(t, list("--pending=false", "--executed=true", "--short"))
assert.Equal(t, "0\n", list("--pending=true", "--executed=false", "--short"))
assert.Equal(t, expectedPending, list("--pending=true", "--executed=false"))

// Now confirm the transaction and assert that it shows up under executed.
harness.MultiSig.ConfirmTransaction(t, test.AccountKey[1], transactionID)

assert.Empty(t, list("--pending=false", "--executed=false"))
assert.Empty(t, list("--pending=true", "--executed=false"))
assert.Equal(t, "0\n", list("--pending=false", "--executed=true"))
assert.Equal(t, expectedExecuted, list("--pending=false", "--executed=true", "--status"))
assert.Empty(t, list("--pending=false", "--executed=false", "--short"))
assert.Empty(t, list("--pending=true", "--executed=false", "--short"))
assert.Equal(t, "0\n", list("--pending=false", "--executed=true", "--short"))
assert.Equal(t, expectedExecuted, list("--pending=false", "--executed=true"))
}
2 changes: 1 addition & 1 deletion params.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func repeatedAddressArg(params clingy.Parameters, name, desc string) []common.Ad
}

func toggleFlag(params clingy.Parameters, name, desc string, def bool) bool {
return params.Flag(name, desc, def, clingy.Transform(strconv.ParseBool)).(bool)
return params.Flag(name, desc, def, clingy.Transform(strconv.ParseBool), clingy.Boolean).(bool)
}

func boolFlag(params clingy.Parameters, name, desc string) bool {
Expand Down
Loading