github.com/klaytn/klaytn@v1.12.1/cmd/homi/main.go (about)

     1  // Copyright 2018 The klaytn Authors
     2  // Copyright 2017 AMIS Technologies
     3  // This file is part of the go-ethereum library.
     4  //
     5  // The go-ethereum library is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU Lesser General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // The go-ethereum library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  // GNU Lesser General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Lesser General Public License
    16  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    17  
    18  package main
    19  
    20  import (
    21  	"fmt"
    22  	"os"
    23  	"path/filepath"
    24  
    25  	"github.com/klaytn/klaytn/cmd/homi/extra"
    26  	"github.com/klaytn/klaytn/cmd/homi/setup"
    27  	"github.com/klaytn/klaytn/cmd/utils/nodecmd"
    28  	"github.com/urfave/cli/v2"
    29  )
    30  
    31  func main() {
    32  	app := cli.NewApp()
    33  	app.Action = setup.Gen
    34  	app.Name = filepath.Base(os.Args[0])
    35  	// app.Author = ""
    36  	// app.Email = ""
    37  	app.Usage = "the klaytn-tools command line interface"
    38  
    39  	app.Version = "v0.3.3"
    40  	app.Copyright = "Copyright 2018-2023 The klaytn Authors"
    41  	app.Commands = []*cli.Command{
    42  		setup.SetupCommand,
    43  		extra.ExtraCommand,
    44  	}
    45  
    46  	app.Flags = append(app.Flags, setup.HomiFlags...)
    47  	app.CommandNotFound = nodecmd.CommandNotExist
    48  	app.OnUsageError = nodecmd.OnUsageError
    49  	app.Before = setup.BeforeRunHomi
    50  
    51  	if err := app.Run(os.Args); err != nil {
    52  		fmt.Fprintln(os.Stderr, err)
    53  		os.Exit(1)
    54  	}
    55  }