refine the command about compiling sol file and creating peerID#333
Open
refine the command about compiling sol file and creating peerID#333
Conversation
WWHAY
commented
Nov 27, 2019
- refine the printing
- refine the systerm about creating peerID
added 2 commits
November 28, 2019 15:09
Jerick26
reviewed
Dec 2, 2019
commands/box/common/common.go
Outdated
| } | ||
| return true | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
IsHexFormat and GetCurrentFilePath is redundant
Jerick26
reviewed
Dec 2, 2019
commands/box/common/common.go
Outdated
| } | ||
|
|
||
| //SetFlag set a flage to flag the file | ||
| func SetFlag(cmd *cobra.Command) { |
Contributor
There was a problem hiding this comment.
AddInputFlag
AddOutPutFlag
Jerick26
reviewed
Dec 2, 2019
commands/box/common/common.go
Outdated
| var ( | ||
| DefaultWalletDir = path.Join(util.HomeDir(), ".box_keystore") | ||
| OutFilePath string | ||
| InFilePath string |
Contributor
There was a problem hiding this comment.
remove the two global variable
Jerick26
reviewed
Dec 2, 2019
commands/box/util/root.go
Outdated
|
|
||
| var ( | ||
| peerIDCmd = &cobra.Command{ | ||
| Use: "peerid [optional|peerkey]", |
Jerick26
reviewed
Dec 3, 2019
| Short: "Compile contract source file", | ||
| Run: compile, | ||
| }, | ||
| } |
Contributor
There was a problem hiding this comment.
compileCmd := &cobra.Command{
Use: "compile",
Short: "Compile contract source file",
Run: compile,
}
Jerick26
reviewed
Dec 3, 2019
| var data string | ||
| switch len(args) { | ||
| case 0: | ||
| if len(inFilePath) == 0 { |
Jerick26
reviewed
Dec 3, 2019
| } | ||
| bytesStr := strings.TrimSpace(string(bytes)) | ||
| if common.IsHexFormat(bytesStr) { | ||
| if _, err := hex.DecodeString(bytesStr); err == nil { |
Jerick26
reviewed
Dec 3, 2019
| } | ||
| filepath := args[0] | ||
| if err := util.FileExists(filepath); err != nil { | ||
| if len(inFilePath) == 0 { |
Jerick26
reviewed
Dec 3, 2019
| filepath := args[0] | ||
| if err := util.FileExists(filepath); err != nil { | ||
| if len(inFilePath) == 0 { | ||
| fmt.Println("please input the path of peer.key") |
Jerick26
reviewed
Dec 3, 2019
| fmt.Println(err) | ||
| return | ||
| } | ||
| if outFilePath == currentFilePath { |
Contributor
There was a problem hiding this comment.
use outFilePath and check it whether is directory
Jerick26
reviewed
Dec 3, 2019
| Use: "peerid [optional|peerkey_path, peerkey]", | ||
| Short: "conversion peer key to peer ID", | ||
| Run: peerID, | ||
| Use: "test [pubkey]", |
Jerick26
reviewed
Dec 3, 2019
| switch len(args) { | ||
| case 0: | ||
| if len(inFilePath) == 0 { | ||
| fmt.Println("please input the path of peer.key") |
Jerick26
reviewed
Dec 3, 2019
| var ( | ||
| peerKeyPath string | ||
| err error | ||
| defaultFile = outFilePath + "/peer.key" |
Contributor
There was a problem hiding this comment.
defaultFile = "./peer.key"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.