From 73c7b408b7dd2ae7167af57607424e59ae6dc6da Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 6 Apr 2020 15:32:06 +0300 Subject: [PATCH 1/3] cli: rename --debug flag in contract compile --- cli/smartcontract/smart_contract.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 7891807e6..73724393e 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -89,8 +89,8 @@ func NewCommands() []cli.Command { Usage: "Output of the compiled contract", }, cli.BoolFlag{ - Name: "debug, d", - Usage: "Debug mode will print out additional information after a compiling", + Name: "verbose, v", + Usage: "Print out additional information after a compiling", }, cli.StringFlag{ Name: "emitdebug", @@ -351,7 +351,7 @@ func contractCompile(ctx *cli.Context) error { o := &compiler.Options{ Outfile: ctx.String("out"), - Debug: ctx.Bool("debug"), + Debug: ctx.Bool("verbose"), DebugInfo: ctx.String("emitdebug"), } From c71ad6a5db48e523a3e28462aeb4a208367157d4 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 6 Apr 2020 15:33:44 +0300 Subject: [PATCH 2/3] cli: output contract after compiling only with --verbose flag Also remove Debug from compiler option as it is used only in CLI. --- cli/smartcontract/smart_contract.go | 5 +++-- pkg/compiler/compiler.go | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 73724393e..df273c39e 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -351,7 +351,6 @@ func contractCompile(ctx *cli.Context) error { o := &compiler.Options{ Outfile: ctx.String("out"), - Debug: ctx.Bool("verbose"), DebugInfo: ctx.String("emitdebug"), } @@ -360,7 +359,9 @@ func contractCompile(ctx *cli.Context) error { if err != nil { return cli.NewExitError(err, 1) } - fmt.Println(hex.EncodeToString(result)) + if ctx.Bool("verbose") { + fmt.Println(hex.EncodeToString(result)) + } return nil } diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index cebfd3e1b..e53c3eaac 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -26,9 +26,6 @@ type Options struct { // The name of the output for debug info. DebugInfo string - - // Debug outputs a hex encoded string of the generated bytecode. - Debug bool } type buildInfo struct { From 450263bcae97b9b50fb8a84e4cb30af2cdd0ed31 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 8 Apr 2020 13:11:44 +0300 Subject: [PATCH 3/3] cli: rename `contract compile` --emitdebug to --debug It is more intuitive and easier to type. --- cli/smartcontract/smart_contract.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index df273c39e..e1445b867 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -93,7 +93,7 @@ func NewCommands() []cli.Command { Usage: "Print out additional information after a compiling", }, cli.StringFlag{ - Name: "emitdebug", + Name: "debug, d", Usage: "Emit debug info in a separate file", }, }, @@ -352,7 +352,7 @@ func contractCompile(ctx *cli.Context) error { o := &compiler.Options{ Outfile: ctx.String("out"), - DebugInfo: ctx.String("emitdebug"), + DebugInfo: ctx.String("debug"), } result, err := compiler.CompileAndSave(src, o)