tutus-chain/cli/app/app.go

42 lines
1.2 KiB
Go
Executable File

package app
import (
"fmt"
"os"
"runtime"
"git.marketally.com/tutus-one/tutus-chain/cli/query"
"git.marketally.com/tutus-one/tutus-chain/cli/server"
"git.marketally.com/tutus-one/tutus-chain/cli/smartcontract"
"git.marketally.com/tutus-one/tutus-chain/cli/util"
"git.marketally.com/tutus-one/tutus-chain/cli/vm"
"git.marketally.com/tutus-one/tutus-chain/cli/wallet"
"git.marketally.com/tutus-one/tutus-chain/pkg/config"
"github.com/urfave/cli/v2"
)
func versionPrinter(c *cli.Context) {
_, _ = fmt.Fprintf(c.App.Writer, "Tutus\nVersion: %s\nGoVersion: %s\n",
config.Version,
runtime.Version(),
)
}
// New creates a Tutus instance of [cli.App] with all commands included.
func New() *cli.App {
cli.VersionPrinter = versionPrinter
ctl := cli.NewApp()
ctl.Name = "tutus"
ctl.Version = config.Version
ctl.Usage = "Sovereign blockchain node"
ctl.ErrWriter = os.Stdout
ctl.Commands = append(ctl.Commands, server.NewCommands()...)
ctl.Commands = append(ctl.Commands, smartcontract.NewCommands()...)
ctl.Commands = append(ctl.Commands, wallet.NewCommands()...)
ctl.Commands = append(ctl.Commands, vm.NewCommands()...)
ctl.Commands = append(ctl.Commands, util.NewCommands()...)
ctl.Commands = append(ctl.Commands, query.NewCommands()...)
return ctl
}