Skip to content

Commit d5102b4

Browse files
committed
remove some commands alias
1 parent bebb212 commit d5102b4

File tree

6 files changed

+52
-11
lines changed

6 files changed

+52
-11
lines changed

cmd/query/debug_traceTransaction.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ func GetQueryTraceTxCommand() *cobra.Command {
2525
cmd := &cobra.Command{
2626
Use: "debug_traceTransaction [0xhash]",
2727
Aliases: []string{"trace"},
28-
Short: "debug_traceTransaction",
29-
Args: cobra.ExactArgs(1),
28+
Short: "Query 'debug_traceTransaction' from EVM RPC",
29+
Long: `Query 'debug_traceTransaction' from EVM RPC, with optional tracer name.
30+
Require 'debug' namespace enabled in EVM RPC node.`,
31+
Args: cobra.ExactArgs(1),
3032
Run: func(cmd *cobra.Command, args []string) {
3133
_, evmRpc := flags.MustGetEthClient(cmd)
3234

cmd/query/deprecated_aliases.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package query
2+
3+
import (
4+
"github.com/bcdevtools/devd/v3/cmd/utils"
5+
"github.com/bcdevtools/devd/v3/constants"
6+
"github.com/spf13/cobra"
7+
"os"
8+
)
9+
10+
func GetDeprecatedAliasBlockAsCommand() *cobra.Command {
11+
cmd := &cobra.Command{
12+
Use: "block [height]",
13+
Hidden: true,
14+
Short: "Deprecated and removed alias of `eth_getBlockByNumber`",
15+
Args: cobra.ExactArgs(1),
16+
Run: func(cmd *cobra.Command, args []string) {
17+
utils.PrintfStdErr("ERR: `block` is a deprecated alias of `eth_getBlockByNumber`. Please use `%s q eth_getBlockByNumber` instead.\n", constants.BINARY_NAME)
18+
os.Exit(1)
19+
},
20+
}
21+
22+
return cmd
23+
}
24+
25+
func GetDeprecatedAliasTxAsCommand() *cobra.Command {
26+
cmd := &cobra.Command{
27+
Use: "tx [hash]",
28+
Hidden: true,
29+
Short: "Deprecated and removed alias of `eth_getTransactionByHash`",
30+
Args: cobra.ExactArgs(1),
31+
Run: func(cmd *cobra.Command, args []string) {
32+
utils.PrintfStdErr("ERR: `tx` is a deprecated alias of `eth_getTransactionByHash`. Please use `%s q eth_getTransactionByHash` instead.\n", constants.BINARY_NAME)
33+
os.Exit(1)
34+
},
35+
}
36+
37+
return cmd
38+
}

cmd/query/eth_getBlockByNumber.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ const (
2222

2323
func GetQueryBlockCommand() *cobra.Command {
2424
cmd := &cobra.Command{
25-
Use: "eth_getBlockByNumber [height dec or 0xHex]",
26-
Aliases: []string{"block"},
27-
Short: "eth_getBlockByNumber",
28-
Args: cobra.ExactArgs(1),
25+
Use: "eth_getBlockByNumber [height dec or 0xHex]",
26+
Short: "Query `eth_getBlockByNumber` from EVM RPC",
27+
Args: cobra.ExactArgs(1),
2928
Run: func(cmd *cobra.Command, args []string) {
3029
_, evmRpc := flags.MustGetEthClient(cmd)
3130

cmd/query/eth_getTransactionByHash.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import (
1616

1717
func GetQueryTxCommand() *cobra.Command {
1818
cmd := &cobra.Command{
19-
Use: "eth_getTransactionByHash [0xhash]",
20-
Aliases: []string{"tx"},
21-
Short: "eth_getTransactionByHash",
22-
Args: cobra.ExactArgs(1),
19+
Use: "eth_getTransactionByHash [0xhash]",
20+
Short: "Query `eth_getTransactionByHash` from EVM RPC",
21+
Args: cobra.ExactArgs(1),
2322
Run: func(cmd *cobra.Command, args []string) {
2423
ethClient, _ := flags.MustGetEthClient(cmd)
2524

cmd/query/eth_getTransactionReceipt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func GetQueryTxReceiptCommand() *cobra.Command {
1818
cmd := &cobra.Command{
1919
Use: "eth_getTransactionReceipt [0xhash]",
2020
Aliases: []string{"receipt"},
21-
Short: "eth_getTransactionReceipt",
21+
Short: "Query `eth_getTransactionReceipt` from EVM RPC",
2222
Args: cobra.ExactArgs(1),
2323
Run: func(cmd *cobra.Command, args []string) {
2424
ethClient, _ := flags.MustGetEthClient(cmd)

cmd/query/root.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func Commands() *cobra.Command {
2727
GetQueryBalanceCommand(),
2828
GetQueryTxsInBlockCommand(),
2929
GetQueryTxEventsCommand(),
30+
// fake command for deprecated alias
31+
GetDeprecatedAliasBlockAsCommand(),
32+
GetDeprecatedAliasTxAsCommand(),
3033
)
3134

3235
return cmd

0 commit comments

Comments
 (0)