Skip to content

Commit d5fa3f8

Browse files
committed
add deprecation notice
1 parent 0830116 commit d5fa3f8

14 files changed

+59
-7
lines changed

cmd/convert/abi_string.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package convert
33
import (
44
"encoding/hex"
55
"fmt"
6+
"github.com/bcdevtools/devd/v2/constants"
67
"regexp"
78
"strings"
89

@@ -12,11 +13,14 @@ import (
1213

1314
func GetConvertAbiStringCmd() *cobra.Command {
1415
cmd := &cobra.Command{
15-
Use: "abi_string [hex or text]",
16-
Short: `Convert ABI encoded hex to string or vice versa.`,
16+
Use: "abi_string [hex or text]",
17+
Aliases: []string{"abi-string"},
18+
Short: `Convert ABI encoded hex to string or vice versa.`,
1719
Long: `Convert ABI encoded hex to string or vice versa.
1820
Support pipe.`,
1921
Run: func(cmd *cobra.Command, args []string) {
22+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert abi-string` (`-` instead of '_')\n", constants.BINARY_NAME)
23+
2024
args, err := utils.ProvidedArgsOrFromPipe(args)
2125
utils.ExitOnErr(err, "failed to get args from pipe")
2226
utils.RequireArgs(args, cmd)

cmd/convert/decimal_to_hexadecimal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"math/big"
67
"os"
78
"strings"
@@ -18,6 +19,8 @@ func GetConvertDecimalToHexadecimalCmd() *cobra.Command {
1819
Long: `Convert decimal to hexadecimal.
1920
Support pipe.`,
2021
Run: func(cmd *cobra.Command, args []string) {
22+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert hex [dec]`\n", constants.BINARY_NAME)
23+
2124
args, err := utils.ProvidedArgsOrFromPipe(args)
2225
utils.ExitOnErr(err, "failed to get args from pipe")
2326
utils.RequireExactArgsCount(args, 1, cmd)

cmd/convert/decode_base64.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package convert
33
import (
44
"encoding/base64"
55
"fmt"
6+
"github.com/bcdevtools/devd/v2/constants"
67

78
"github.com/bcdevtools/devd/v2/cmd/utils"
89
"github.com/spf13/cobra"
@@ -16,6 +17,8 @@ func GetDecodeBase64CaseCmd() *cobra.Command {
1617
Long: `Decode base64.
1718
Support pipe.`,
1819
Run: func(cmd *cobra.Command, args []string) {
20+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert base64 ... --decode`\n", constants.BINARY_NAME)
21+
1922
args, err := utils.ProvidedArgsOrFromPipe(args)
2023
utils.ExitOnErr(err, "failed to get args from pipe")
2124
utils.RequireExactArgsCount(args, 1, cmd)

cmd/convert/decode_raw_evm_tx.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"os"
67
"regexp"
78
"strings"
@@ -12,10 +13,13 @@ import (
1213

1314
func GetDecodeRawEvmTxCommand() *cobra.Command {
1415
cmd := &cobra.Command{
15-
Use: "decode_raw_tx [raw RLP-encoded EVM tx hex]",
16-
Short: `Decode the raw RLP-encoded EVM tx to see inner details, additional information will be injected with prefix '_'`,
17-
Args: cobra.ExactArgs(1),
16+
Use: "decode_raw_tx [raw RLP-encoded EVM tx hex]",
17+
Aliases: []string{"raw-tx"},
18+
Short: `Decode the raw RLP-encoded EVM tx to see inner details, additional information will be injected with prefix '_'`,
19+
Args: cobra.ExactArgs(1),
1820
Run: func(cmd *cobra.Command, args []string) {
21+
utils.PrintfStdErr("WARN: from v3, this command will be moved and renamed to `%s debug raw-tx ...`\n", constants.BINARY_NAME)
22+
1923
rawTx := strings.ToLower(args[0])
2024
if !regexp.MustCompile(`^(0x)?[a-fA-F\d]+$`).MatchString(rawTx) {
2125
utils.PrintlnStdErr("ERR: invalid raw EVM tx, must be valid hex-encoded string")

cmd/convert/encode_base64.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package convert
33
import (
44
"encoding/base64"
55
"fmt"
6+
"github.com/bcdevtools/devd/v2/constants"
67
"strings"
78

89
"github.com/bcdevtools/devd/v2/cmd/utils"
@@ -18,6 +19,8 @@ func GetEncodeBase64CaseCmd() *cobra.Command {
1819
Long: `Encode input text into base64.
1920
Support pipe.`,
2021
Run: func(cmd *cobra.Command, args []string) {
22+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert base64 ...`\n", constants.BINARY_NAME)
23+
2124
args, err := utils.ProvidedArgsOrFromPipe(args)
2225
utils.ExitOnErr(err, "failed to get args from pipe")
2326
utils.RequireArgs(args, cmd)

cmd/convert/hexadecimal_to_decimal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"math/big"
67
"os"
78
"regexp"
@@ -19,6 +20,8 @@ func GetConvertHexadecimalToDecimalCmd() *cobra.Command {
1920
Long: `Convert hexadecimal to decimal.
2021
Support pipe.`,
2122
Run: func(cmd *cobra.Command, args []string) {
23+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert hex [0xHex]`\n", constants.BINARY_NAME)
24+
2225
args, err := utils.ProvidedArgsOrFromPipe(args)
2326
utils.ExitOnErr(err, "failed to get args from pipe")
2427
utils.RequireExactArgsCount(args, 1, cmd)

cmd/convert/solc_sig.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"regexp"
67
"strings"
78

@@ -14,8 +15,9 @@ import (
1415
// GetConvertSolcSignatureCmd creates a helper command that convert EVM method/event into keccak256 hash and 4 bytes signature
1516
func GetConvertSolcSignatureCmd() *cobra.Command {
1617
cmd := &cobra.Command{
17-
Use: "solc_sig [method or event]",
18-
Short: "Convert Solidity method/event signature into hashed signature and 4 bytes signature.",
18+
Use: "solc_sig [method or event]",
19+
Aliases: []string{"solc-sig"},
20+
Short: "Convert Solidity method/event signature into hashed signature and 4 bytes signature.",
1921
Long: `Convert Solidity method/event signature into hashed signature and 4 bytes signature.
2022
Output will be 4 lines:
2123
1. Type: Method/Event
@@ -25,6 +27,8 @@ Output will be 4 lines:
2527
`,
2628
Args: cobra.MinimumNArgs(1),
2729
Run: func(cmd *cobra.Command, args []string) {
30+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert solc-sig ...`\n", constants.BINARY_NAME)
31+
2832
_interface := strings.Join(args, " ")
2933

3034
_4BytesSig, hash, finalInterface, err := getSignatureFromInterface(_interface)

cmd/convert/to_lower_case.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"strings"
67

78
"github.com/bcdevtools/devd/v2/cmd/utils"
@@ -17,6 +18,8 @@ func GetConvertToLowerCaseCmd() *cobra.Command {
1718
Long: `Convert input text into lower case.
1819
Support pipe.`,
1920
Run: func(cmd *cobra.Command, args []string) {
21+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert case ...`\n", constants.BINARY_NAME)
22+
2023
var err error
2124
args, err = utils.ProvidedArgsOrFromPipe(args)
2225
utils.ExitOnErr(err, "failed to get args from pipe")

cmd/convert/to_upper_case.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package convert
22

33
import (
44
"fmt"
5+
"github.com/bcdevtools/devd/v2/constants"
56
"strings"
67

78
"github.com/bcdevtools/devd/v2/cmd/utils"
@@ -17,6 +18,8 @@ func GetConvertToUpperCaseCmd() *cobra.Command {
1718
Long: `Convert input text into upper case.
1819
Support pipe.`,
1920
Run: func(cmd *cobra.Command, args []string) {
21+
utils.PrintfStdErr("WARN: from v3, this command will be renamed to `%s convert case ... --upper`\n", constants.BINARY_NAME)
22+
2023
var err error
2124
args, err = utils.ProvidedArgsOrFromPipe(args)
2225
utils.ExitOnErr(err, "failed to get args from pipe")

cmd/query/eth_getBlockByNumber.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package query
33
import (
44
"encoding/json"
55
"fmt"
6+
"github.com/bcdevtools/devd/v2/constants"
67
ethtypes "github.com/ethereum/go-ethereum/core/types"
78
"math/big"
89
"os"
@@ -21,6 +22,8 @@ func GetQueryBlockCommand() *cobra.Command {
2122
Short: "eth_getBlockByNumber",
2223
Args: cobra.ExactArgs(1),
2324
Run: func(cmd *cobra.Command, args []string) {
25+
utils.PrintfStdErr("WARN! Deprecation notice: from v3, command alias `block` will be removed, please use `%s q eth_getBlockByNumber ...` instead of `%s q block ...`\n", constants.BINARY_NAME, constants.BINARY_NAME)
26+
2427
_, rpc := mustGetEthClient(cmd, false)
2528

2629
input := strings.ToLower(args[0])

0 commit comments

Comments
 (0)