Debug Flag, Run -> RunE

This commit is contained in:
Rigel Rozanski
2017-04-21 12:34:11 -04:00
committed by Ethan Buchman
parent 5ebdd964c5
commit c292d54e47
19 changed files with 178 additions and 155 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ var (
ExamplePluginTxCmd = &cobra.Command{
Use: "example",
Short: "Create, sign, and broadcast a transaction to the example plugin",
Run: examplePluginTxCmd,
RunE: examplePluginTxCmd,
}
)
@@ -35,7 +35,7 @@ func init() {
}
//Send a transaction
func examplePluginTxCmd(cmd *cobra.Command, args []string) {
func examplePluginTxCmd(cmd *cobra.Command, args []string) error {
// Create a transaction using the flag.
// The tx passes on custom information to the plugin
@@ -58,5 +58,5 @@ func examplePluginTxCmd(cmd *cobra.Command, args []string) {
// - Once deserialized, the tx is passed to `state.ExecTx` (state/execution.go)
// - If the tx passes various checks, the `tx.Data` is forwarded as `txBytes` to `plugin.RunTx` (docs/guide/src/example-plugin/plugin.go)
// - Finally, it deserialized back to the ExamplePluginTx
commands.AppTx("example-plugin", exampleTxBytes)
return commands.AppTx("example-plugin", exampleTxBytes)
}
+1 -7
View File
@@ -1,9 +1,6 @@
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/tendermint/basecoin/cmd/commands"
@@ -31,8 +28,5 @@ func main() {
)
//Run the root command
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
commands.ExecuteWithDebug(RootCmd)
}