github.com/turingchain2020/turingchain@v1.1.21/cmd/tools/main.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"os"
     9  
    10  	"github.com/turingchain2020/turingchain/cmd/tools/commands"
    11  	"github.com/turingchain2020/turingchain/common/log"
    12  	"github.com/spf13/cobra"
    13  )
    14  
    15  //var (
    16  //	mlog = log15.New("module", "tools")
    17  //)
    18  
    19  func main() {
    20  	log.SetLogLevel("debug")
    21  	runCommands()
    22  }
    23  
    24  func addCommands(rootCmd *cobra.Command) {
    25  	rootCmd.AddCommand(
    26  		commands.ImportCmd(),
    27  		commands.UpdateInitCmd(),
    28  		commands.CreatePluginCmd(),
    29  		commands.GenDappCmd(),
    30  	)
    31  }
    32  
    33  func runCommands() {
    34  	rootCmd := &cobra.Command{
    35  		Use:   "tools",
    36  		Short: "turingchain tools",
    37  	}
    38  	addCommands(rootCmd)
    39  
    40  	if err := rootCmd.Execute(); err != nil {
    41  		//mlog.Error("Execute command failed.", "error", err)
    42  		os.Exit(1)
    43  	}
    44  }