github.com/amazechain/amc@v0.1.3/cmd/amc/main.go (about)

     1  // Copyright 2022 The AmazeChain Authors
     2  // This file is part of the AmazeChain library.
     3  //
     4  // The AmazeChain library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The AmazeChain library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the AmazeChain library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package main
    18  
    19  import (
    20  	"fmt"
    21  	"os"
    22  
    23  	"github.com/amazechain/amc/params"
    24  	"github.com/urfave/cli/v2"
    25  
    26  	// Force-load the tracer engines to trigger registration
    27  	_ "github.com/amazechain/amc/internal/tracers/js"
    28  	_ "github.com/amazechain/amc/internal/tracers/native"
    29  )
    30  
    31  func main() {
    32  	flags := append(networkFlags, consensusFlag...)
    33  	flags = append(flags, loggerFlag...)
    34  	flags = append(flags, pprofCfg...)
    35  	flags = append(flags, nodeFlg...)
    36  	flags = append(flags, rpcFlags...)
    37  	flags = append(flags, authRPCFlag...)
    38  	flags = append(flags, configFlag...)
    39  	flags = append(flags, settingFlag...)
    40  	flags = append(flags, accountFlag...)
    41  	flags = append(flags, metricsFlags...)
    42  	flags = append(flags, p2pFlags...)
    43  	flags = append(flags, p2pLimitFlags...)
    44  
    45  	rootCmd = append(rootCmd, walletCommand, accountCommand, exportCommand, initCommand)
    46  	commands := rootCmd
    47  
    48  	app := &cli.App{
    49  		Name:     "amc",
    50  		Usage:    "AmazeChain system",
    51  		Flags:    flags,
    52  		Commands: commands,
    53  		//Version:                version.FormatVersion(),
    54  		Version:                params.VersionWithCommit(params.GitCommit, ""),
    55  		UseShortOptionHandling: true,
    56  		Action:                 appRun,
    57  	}
    58  
    59  	err := app.Run(os.Args)
    60  	if err != nil {
    61  		fmt.Printf("failed amc system setup %v", err)
    62  	}
    63  }