當前位置: 首頁>>代碼示例>>Golang>>正文


Golang utils.NewApp函數代碼示例

本文整理匯總了Golang中github.com/ethereum/go-ethereum/cmd/utils.NewApp函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewApp函數的具體用法?Golang NewApp怎麽用?Golang NewApp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewApp函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: init

func init() {
	app = utils.NewApp("0.0.1", "gll compiler")
	app.Flags = []cli.Flag{
		DebugFlag,
		StackFlag,
	}
	app.Action = run
}
開發者ID:obscuren,項目名稱:cll,代碼行數:8,代碼來源:main.go

示例2: init

func init() {
	app = utils.NewApp("0.2", "the evm command line interface")
	app.Flags = []cli.Flag{
		DebugFlag,
		SysStatFlag,
		CodeFlag,
		GasFlag,
		PriceFlag,
		ValueFlag,
		DumpFlag,
		InputFlag,
	}
	app.Action = run
}
開發者ID:nilcons-contrib,項目名稱:go-ethereum,代碼行數:14,代碼來源:main.go

示例3: init

func init() {
	app = utils.NewApp("0.2", "the evm command line interface")
	app.Flags = []cli.Flag{
		CreateFlag,
		DebugFlag,
		VerbosityFlag,
		ForceJitFlag,
		DisableJitFlag,
		SysStatFlag,
		CodeFlag,
		GasFlag,
		PriceFlag,
		ValueFlag,
		DumpFlag,
		InputFlag,
	}
	app.Action = run
}
開發者ID:Codzart,項目名稱:go-ethereum,代碼行數:18,代碼來源:main.go

示例4: init

func init() {
	if gitCommit == "" {
		nodeNameVersion = Version
	} else {
		nodeNameVersion = Version + "-" + gitCommit[:8]
	}

	app = utils.NewApp(Version, "the go-ethereum command line interface")
	app.Action = run
	app.HideVersion = true // we have a command to print the version
	app.Commands = []cli.Command{
		{
			Action: blockRecovery,
			Name:   "recover",
			Usage:  "attempts to recover a corrupted database by setting a new block by number or hash. See help recover.",
			Description: `
The recover commands will attempt to read out the last
block based on that.

recover #number recovers by number
recover <hex> recovers by hash
`,
		},
		blocktestCommand,
		importCommand,
		exportCommand,
		upgradedbCommand,
		removedbCommand,
		dumpCommand,
		monitorCommand,
		{
			Action: makedag,
			Name:   "makedag",
			Usage:  "generate ethash dag (for testing)",
			Description: `
The makedag command generates an ethash DAG in /tmp/dag.

This command exists to support the system testing project.
Regular users do not need to execute it.
`,
		},
		{
			Action: version,
			Name:   "version",
			Usage:  "print ethereum version numbers",
			Description: `
The output of this command is supposed to be machine-readable.
`,
		},

		{
			Name:  "wallet",
			Usage: "ethereum presale wallet",
			Subcommands: []cli.Command{
				{
					Action: importWallet,
					Name:   "import",
					Usage:  "import ethereum presale wallet",
				},
			},
			Description: `

    get wallet import /path/to/my/presale.wallet

will prompt for your password and imports your ether presale account.
It can be used non-interactively with the --password option taking a
passwordfile as argument containing the wallet password in plaintext.

`},
		{
			Action: accountList,
			Name:   "account",
			Usage:  "manage accounts",
			Description: `

Manage accounts lets you create new accounts, list all existing accounts,
import a private key into a new account.

'            help' shows a list of subcommands or help for one subcommand.

It supports interactive mode, when you are prompted for password as well as
non-interactive mode where passwords are supplied via a given password file.
Non-interactive mode is only meant for scripted use on test networks or known
safe environments.

Make sure you remember the password you gave when creating a new account (with
either new or import). Without it you are not able to unlock your account.

Note that exporting your key in unencrypted format is NOT supported.

Keys are stored under <DATADIR>/keys.
It is safe to transfer the entire directory or the individual keys therein
between ethereum nodes by simply copying.
Make sure you backup your keys regularly.

In order to use your account to send transactions, you need to unlock them using the
'--unlock' option. The argument is a comma

And finally. DO NOT FORGET YOUR PASSWORD.
`,
//.........這裏部分代碼省略.........
開發者ID:etherume,項目名稱:go-ethereum,代碼行數:101,代碼來源:main.go

示例5: init

func init() {
	// Construct the textual version string from the individual components
	verString = fmt.Sprintf("%d.%d.%d", versionMajor, versionMinor, versionPatch)
	if versionMeta != "" {
		verString += "-" + versionMeta
	}
	if gitCommit != "" {
		verString += "-" + gitCommit[:8]
	}
	// Construct the version release oracle configuration
	relConfig.Oracle = common.HexToAddress(versionOracle)

	relConfig.Major = uint32(versionMajor)
	relConfig.Minor = uint32(versionMinor)
	relConfig.Patch = uint32(versionPatch)

	commit, _ := hex.DecodeString(gitCommit)
	copy(relConfig.Commit[:], commit)

	// Initialize the CLI app and start Geth
	app = utils.NewApp(verString, "the go-ethereum command line interface")
	app.Action = geth
	app.HideVersion = true // we have a command to print the version
	app.Commands = []cli.Command{
		importCommand,
		exportCommand,
		upgradedbCommand,
		removedbCommand,
		dumpCommand,
		monitorCommand,
		accountCommand,
		walletCommand,
		consoleCommand,
		attachCommand,
		javascriptCommand,
		{
			Action: makedag,
			Name:   "makedag",
			Usage:  "generate ethash dag (for testing)",
			Description: `
The makedag command generates an ethash DAG in /tmp/dag.

This command exists to support the system testing project.
Regular users do not need to execute it.
`,
		},
		{
			Action: gpuinfo,
			Name:   "gpuinfo",
			Usage:  "gpuinfo",
			Description: `
Prints OpenCL device info for all found GPUs.
`,
		},
		{
			Action: gpubench,
			Name:   "gpubench",
			Usage:  "benchmark GPU",
			Description: `
Runs quick benchmark on first GPU found.
`,
		},
		{
			Action: version,
			Name:   "version",
			Usage:  "print ethereum version numbers",
			Description: `
The output of this command is supposed to be machine-readable.
`,
		},
		{
			Action: initGenesis,
			Name:   "init",
			Usage:  "bootstraps and initialises a new genesis block (JSON)",
			Description: `
The init command initialises a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
participating.
`,
		},
	}

	app.Flags = []cli.Flag{
		utils.IdentityFlag,
		utils.UnlockedAccountFlag,
		utils.PasswordFileFlag,
		utils.GenesisFileFlag,
		utils.BootnodesFlag,
		utils.DataDirFlag,
		utils.KeyStoreDirFlag,
		utils.BlockchainVersionFlag,
		utils.OlympicFlag,
		utils.FastSyncFlag,
		utils.CacheFlag,
		utils.LightKDFFlag,
		utils.JSpathFlag,
		utils.ListenPortFlag,
		utils.MaxPeersFlag,
		utils.MaxPendingPeersFlag,
		utils.EtherbaseFlag,
//.........這裏部分代碼省略.........
開發者ID:FrankoCollective,項目名稱:go-ethereum,代碼行數:101,代碼來源:main.go

示例6: init

	"github.com/ethereum/go-ethereum/eth"
	"github.com/ethereum/go-ethereum/logger"
	"github.com/ethereum/go-ethereum/ui/qt/webengine"
	"github.com/obscuren/qml"
)

const (
	ClientIdentifier = "Mist"
	Version          = "0.9.0"
)

var (
	gitCommit       string // set via linker flag
	nodeNameVersion string

	app           = utils.NewApp(Version, "the ether browser")
	assetPathFlag = cli.StringFlag{
		Name:  "asset_path",
		Usage: "absolute path to GUI assets directory",
		Value: common.DefaultAssetPath(),
	}
	rpcCorsFlag = utils.RPCCORSDomainFlag
)

func init() {
	// Mist-specific default
	if len(rpcCorsFlag.Value) == 0 {
		rpcCorsFlag.Value = "http://localhost"
	}
	if gitCommit == "" {
		nodeNameVersion = Version
開發者ID:CedarLogic,項目名稱:go-ethereum,代碼行數:31,代碼來源:main.go

示例7: init

	"runtime"

	"github.com/ethereum/go-ethereum/cmd/utils"
	"github.com/ethereum/go-ethereum/core"

	"github.com/ethereum/go-ethereum/eth"
	"github.com/ethereum/go-ethereum/logger"
)

const (
	Version = "0.0.2"
)

var (
	clilogger = logger.NewLogger("Parser")
	app       = utils.NewApp(Version, "Ethereum chain parser")
)

func init() {
	app.Action = run
	app.Name = "BlockParser"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "mongo-url",
			Value: "mongodb://localhost",
			Usage: "MongoDB connection url",
		},
		cli.StringFlag{
			Name:  "mongo-database",
			Value: "chain_explorer",
			Usage: "MongoDB database",
開發者ID:gerrit-rws,項目名稱:ecp,代碼行數:31,代碼來源:main.go

示例8: main

func main() {
	app := utils.NewApp(Version, "the geth-tmsp command line interface")
	app.Action = run
	app.Flags = []cli.Flag{
		gethapp.TendermintCoreHostFlag,

		utils.IdentityFlag,
		utils.UnlockedAccountFlag,
		utils.PasswordFileFlag,
		utils.GenesisFileFlag,
		utils.BootnodesFlag,
		utils.DataDirFlag,
		utils.BlockchainVersionFlag,
		utils.OlympicFlag,
		utils.FastSyncFlag,
		utils.CacheFlag,
		utils.LightKDFFlag,
		utils.JSpathFlag,
		utils.ListenPortFlag,
		utils.MaxPeersFlag,
		utils.MaxPendingPeersFlag,
		utils.EtherbaseFlag,
		utils.GasPriceFlag,
		utils.MinerThreadsFlag,
		utils.MiningEnabledFlag,
		utils.MiningGPUFlag,
		utils.AutoDAGFlag,
		utils.NATFlag,
		utils.NatspecEnabledFlag,
		utils.NoDiscoverFlag,
		utils.NodeKeyFileFlag,
		utils.NodeKeyHexFlag,
		utils.RPCEnabledFlag,
		utils.RPCListenAddrFlag,
		utils.RPCPortFlag,
		utils.RpcApiFlag,
		utils.IPCDisabledFlag,
		utils.IPCApiFlag,
		utils.IPCPathFlag,
		utils.ExecFlag,
		utils.WhisperEnabledFlag,
		utils.DevModeFlag,
		utils.TestNetFlag,
		utils.VMDebugFlag,
		utils.VMForceJitFlag,
		utils.VMJitCacheFlag,
		utils.VMEnableJitFlag,
		utils.NetworkIdFlag,
		utils.RPCCORSDomainFlag,
		utils.VerbosityFlag,
		utils.BacktraceAtFlag,
		utils.LogVModuleFlag,
		utils.LogFileFlag,
		utils.PProfEanbledFlag,
		utils.PProfPortFlag,
		utils.MetricsEnabledFlag,
		utils.SolcPathFlag,
		utils.GpoMinGasPriceFlag,
		utils.GpoMaxGasPriceFlag,
		utils.GpoFullBlockRatioFlag,
		utils.GpobaseStepDownFlag,
		utils.GpobaseStepUpFlag,
		utils.GpobaseCorrectionFactorFlag,
		utils.ExtraDataFlag,
	}
	app.Before = func(ctx *cli.Context) error {
		utils.SetupLogger(ctx)
		utils.SetupNetwork(ctx)
		utils.SetupVM(ctx)
		if ctx.GlobalBool(utils.PProfEanbledFlag.Name) {
			utils.StartPProf(ctx)
		}
		return nil
	}
	app.Run(os.Args)
}
開發者ID:zramsay,項目名稱:geth-tmsp,代碼行數:76,代碼來源:main.go


注:本文中的github.com/ethereum/go-ethereum/cmd/utils.NewApp函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。