Skip to content

Commit

Permalink
Change transaction list status default (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtolio authored Feb 21, 2024
1 parent 03f764e commit 7de51f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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 @@ -50,16 +50,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 @@ -51,7 +51,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

0 comments on commit 7de51f9

Please sign in to comment.