Skip to content

refine the command about compiling sol file and creating peerID#333

Open
WWHAY wants to merge 5 commits intobposfrom
add_command
Open

refine the command about compiling sol file and creating peerID#333
WWHAY wants to merge 5 commits intobposfrom
add_command

Conversation

@WWHAY
Copy link

@WWHAY WWHAY commented Nov 27, 2019

  1. refine the printing
  2. refine the systerm about creating peerID

}
return true
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsHexFormat and GetCurrentFilePath is redundant

}

//SetFlag set a flage to flag the file
func SetFlag(cmd *cobra.Command) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddInputFlag
AddOutPutFlag

var (
DefaultWalletDir = path.Join(util.HomeDir(), ".box_keystore")
OutFilePath string
InFilePath string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the two global variable


var (
peerIDCmd = &cobra.Command{
Use: "peerid [optional|peerkey]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showpeerid

Short: "Compile contract source file",
Run: compile,
},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compileCmd := &cobra.Command{
Use: "compile",
Short: "Compile contract source file",
Run: compile,
}

var data string
switch len(args) {
case 0:
if len(inFilePath) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if inFilePath == ""

}
bytesStr := strings.TrimSpace(string(bytes))
if common.IsHexFormat(bytesStr) {
if _, err := hex.DecodeString(bytesStr); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return bytesStr, "", nil

}
filepath := args[0]
if err := util.FileExists(filepath); err != nil {
if len(inFilePath) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if inFilePath == "" {

filepath := args[0]
if err := util.FileExists(filepath); err != nil {
if len(inFilePath) == 0 {
fmt.Println("please input the path of peer.key")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contract source file

fmt.Println(err)
return
}
if outFilePath == currentFilePath {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use outFilePath and check it whether is directory

Use: "peerid [optional|peerkey_path, peerkey]",
Short: "conversion peer key to peer ID",
Run: peerID,
Use: "test [pubkey]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

switch len(args) {
case 0:
if len(inFilePath) == 0 {
fmt.Println("please input the path of peer.key")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

println(cmd.Use)

var (
peerKeyPath string
err error
defaultFile = outFilePath + "/peer.key"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultFile = "./peer.key"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants