-
Notifications
You must be signed in to change notification settings - Fork 330
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
[ioctl] create main for ioctl/newcmd #3296
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3296 +/- ##
==========================================
- Coverage 75.30% 75.28% -0.02%
==========================================
Files 239 241 +2
Lines 22171 22258 +87
==========================================
+ Hits 16696 16758 +62
- Misses 4578 4597 +19
- Partials 897 903 +6
Continue to review full report at Codecov.
|
pls update the cmd in https://github.com/iotexproject/iotex-core/blob/master/Makefile |
done: |
@@ -0,0 +1,155 @@ | |||
// Copyright (c) 2022 IoTeX Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 4 new files file another PR like "add config command"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, just add function, but no specific implementation. this will be done after merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, delete command function and create new pr for it
ioctl/newcmd/config/cofig_get.go
Outdated
@@ -0,0 +1,52 @@ | |||
// Copyright (c) 2022 IoTeX Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config_get.go
ioctl/newcmd/config/cofig_reset.go
Outdated
@@ -0,0 +1,42 @@ | |||
// Copyright (c) 2022 IoTeX Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config_reset.go
ioctl/newcmd/config/cofig_set.go
Outdated
@@ -0,0 +1,52 @@ | |||
// Copyright (c) 2022 IoTeX Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config_set.go
tools/newioctl/ioctl.go
Outdated
rootCmd := newcmd.NewIoctl(client) | ||
if err := rootCmd.Execute(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if err := newcmd.NewIoctl(client).Execute(); err != nil {
tools/newxctl/xctl.go
Outdated
rootCmd := newcmd.NewXctl(client) | ||
if err := rootCmd.Execute(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if err := newcmd.NewXctl(client).Execute(); err != nil {
ioctl/newcmd/config/config.go
Outdated
} | ||
|
||
// InitConfig load config data from default config file | ||
func InitConfig() (config.Config, string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to return err. because if err!=nil, panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Multiple places return error
- the error handling logic is the same,
panic
Thus, returning the error and handle it in the caller side is a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, Thanks.
ioctl/newcmd/config/config.go
Outdated
if err != nil { | ||
if os.IsNotExist(err) { | ||
err = info.reset() // Config file doesn't exist | ||
} | ||
if err != nil { | ||
log.L().Panic(err.Error()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the logic is not clear
ioctl/newcmd/config/config.go
Outdated
) | ||
|
||
// Info contains the information of config file | ||
type Info struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private struct
@@ -0,0 +1,155 @@ | |||
// Copyright (c) 2022 IoTeX Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
ioctl/newcmd/config/config.go
Outdated
|
||
// Load or reset config file | ||
info.readConfig, err = config.LoadConfig() | ||
if err != nil && os.IsNotExist(err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* create main for ioctl/newcmd
* [ioctl] build hdwallet derive command line into new ioctl * inline DeriveKey * adjust order * revert DeriveKey inline * create ExportHdwallet client interface combine hdwalletderive & hdwalletexport code and create ExportHdwallet client interface * [ioctl] create main for ioctl/newcmd (#3296) * create main for ioctl/newcmd * change return type of HdwalletMnemonic * refactor unit test to cover the modification * refactor unit test to cover the modification * fix commit * fix commit Co-authored-by: huofei <[email protected]> Co-authored-by: CoderZhi <[email protected]>
* upstream/master: (24 commits) account type with zero init nonce (iotexproject#3387) [api] Separate Server and Server Handler (iotexproject#3485) [ioctl] Build hdwallet derive command line into new ioctl (iotexproject#3418) [ioctl] Build hdwallet create command line into new ioctl (iotexproject#3470) [makefile] add go mod tidy (iotexproject#3471) [api] update chain metrics (iotexproject#3484) remove config.EVMNetworkID() (iotexproject#3460) [filedao] remove checkMasterChainDBFile() (iotexproject#3463) [api] add crashlog (iotexproject#3456) [api] Move generateBlockMeta to grpcserver.go (iotexproject#3303) [ioctl] Build action hash command line into new ioctl (iotexproject#3425) [ioctl] Build hdwallet export command line into new ioctl (iotexproject#3423) [ioctl] Refactor nodereward command in new ioctl (iotexproject#3416) [ioctl] Cleanup TestNewNodeDelegateCmd (iotexproject#3421) [blockchain] Remove BoltDBDaoOption (iotexproject#3465) remove InMemDaoOption (iotexproject#3464) [action] add evm london test (iotexproject#3402) [ioctl] create main for ioctl/newcmd (iotexproject#3296) [ioctl] Build block bucket command line into new ioctl (iotexproject#3386) [ioctl] Build hdwallet import command line into new ioctl (iotexproject#3419) ...
Description
Create main function to test ioctl/newcmd/account. Run in command line.
make newioctl
./bin/newioctl account createadd test1
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: