cli: clean up flag descriptions, usage docs, account list uses primary and indexes, add help line to account subcnd usage

This commit is contained in:
zelig 2015-04-22 00:41:34 +01:00
parent 22450c069b
commit 7b2f25b578
3 changed files with 25 additions and 29 deletions

View File

@ -283,10 +283,6 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
} }
} }
am := js.ethereum.AccountManager() am := js.ethereum.AccountManager()
// err := am.Unlock(common.FromHex(split[0]), split[1])
// if err != nil {
// utils.Fatalf("Unlock account failed '%v'", err)
// }
err = am.TimedUnlock(common.FromHex(addr), passphrase, time.Duration(seconds)*time.Second) err = am.TimedUnlock(common.FromHex(addr), passphrase, time.Duration(seconds)*time.Second)
if err != nil { if err != nil {
fmt.Printf("Unlock account failed '%v'\n", err) fmt.Printf("Unlock account failed '%v'\n", err)

View File

@ -97,6 +97,8 @@ The output of this command is supposed to be machine-readable.
Manage accounts lets you create new accounts, list all existing accounts, Manage accounts lets you create new accounts, list all existing accounts,
import a private key into a new account. import a private key into a new account.
'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 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 where passwords are supplied via a given password file.
Non-interactive mode is only meant for scripted use on test networks or known Non-interactive mode is only meant for scripted use on test networks or known
@ -186,8 +188,8 @@ Use "ethereum dump 0" to dump the genesis block.
Usage: `Geth Console: interactive JavaScript environment`, Usage: `Geth Console: interactive JavaScript environment`,
Description: ` Description: `
The Geth console is an interactive shell for the JavaScript runtime environment The Geth console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the DAPP JavaScript API. which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console
`, `,
}, },
{ {
@ -195,7 +197,7 @@ See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console
Name: "js", Name: "js",
Usage: `executes the given JavaScript files in the Geth JavaScript VM`, Usage: `executes the given JavaScript files in the Geth JavaScript VM`,
Description: ` Description: `
The JavaScript VM exposes a node admin interface as well as the DAPP The JavaScript VM exposes a node admin interface as well as the Ðapp
JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console
`, `,
}, },
@ -261,10 +263,6 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
// flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0") // flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0")
// flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false") // flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false")
// potential subcommands:
// flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
// flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
// flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
} }
func main() { func main() {
@ -369,8 +367,10 @@ func accountList(ctx *cli.Context) {
if err != nil { if err != nil {
utils.Fatalf("Could not list accounts: %v", err) utils.Fatalf("Could not list accounts: %v", err)
} }
for _, acct := range accts { name := "Primary"
fmt.Printf("Address: %x\n", acct) for i, acct := range accts {
fmt.Printf("%s #%d: %x\n", name, i, acct)
name = "Account"
} }
} }

View File

@ -79,22 +79,22 @@ var (
} }
ProtocolVersionFlag = cli.IntFlag{ ProtocolVersionFlag = cli.IntFlag{
Name: "protocolversion", Name: "protocolversion",
Usage: "ETH protocol version", Usage: "ETH protocol version (integer)",
Value: eth.ProtocolVersion, Value: eth.ProtocolVersion,
} }
NetworkIdFlag = cli.IntFlag{ NetworkIdFlag = cli.IntFlag{
Name: "networkid", Name: "networkid",
Usage: "Network Id", Usage: "Network Id (integer)",
Value: eth.NetworkId, Value: eth.NetworkId,
} }
BlockchainVersionFlag = cli.IntFlag{ BlockchainVersionFlag = cli.IntFlag{
Name: "blockchainversion", Name: "blockchainversion",
Usage: "Blockchain version", Usage: "Blockchain version (integer)",
Value: core.BlockChainVersion, Value: core.BlockChainVersion,
} }
IdentityFlag = cli.StringFlag{ IdentityFlag = cli.StringFlag{
Name: "identity", Name: "identity",
Usage: "node name", Usage: "Custom node name",
} }
NatspecEnabledFlag = cli.BoolFlag{ NatspecEnabledFlag = cli.BoolFlag{
Name: "natspec", Name: "natspec",
@ -113,18 +113,18 @@ var (
} }
EtherbaseFlag = cli.StringFlag{ EtherbaseFlag = cli.StringFlag{
Name: "etherbase", Name: "etherbase",
Usage: "public address for block mining rewards. By default the address of your primary account is used", Usage: "Public address for block mining rewards. By default the address of your primary account is used",
Value: "primary", Value: "primary",
} }
UnlockedAccountFlag = cli.StringFlag{ UnlockedAccountFlag = cli.StringFlag{
Name: "unlock", Name: "unlock",
Usage: "unlock the account given until this program exits (prompts for password). '--unlock primary' unlocks the primary account", Usage: "Unlock the account given until this program exits (prompts for password). '--unlock primary' unlocks the primary account",
Value: "", Value: "",
} }
PasswordFileFlag = cli.StringFlag{ PasswordFileFlag = cli.StringFlag{
Name: "password", Name: "password",
Usage: "Path to password file for (un)locking an existing account.", Usage: "Path to password file to use with options and subcommands needing a password",
Value: "", Value: "",
} }
@ -135,7 +135,7 @@ var (
} }
LogLevelFlag = cli.IntFlag{ LogLevelFlag = cli.IntFlag{
Name: "loglevel", Name: "loglevel",
Usage: "0-5 (silent, error, warn, info, debug, debug detail)", Usage: "Logging verbosity: 0-6 (0=silent, 1=error, 2=warn, 3=info, 4=core, 5=debug, 6=debug detail)",
Value: int(logger.InfoLevel), Value: int(logger.InfoLevel),
} }
LogJSONFlag = cli.StringFlag{ LogJSONFlag = cli.StringFlag{
@ -149,7 +149,7 @@ var (
} }
LogVModuleFlag = cli.GenericFlag{ LogVModuleFlag = cli.GenericFlag{
Name: "vmodule", Name: "vmodule",
Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a V level.", Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.",
Value: glog.GetVModule(), Value: glog.GetVModule(),
} }
VMDebugFlag = cli.BoolFlag{ VMDebugFlag = cli.BoolFlag{
@ -158,12 +158,12 @@ var (
} }
BacktraceAtFlag = cli.GenericFlag{ BacktraceAtFlag = cli.GenericFlag{
Name: "backtrace_at", Name: "backtrace_at",
Usage: "When set to a file and line number holding a logging statement a stack trace will be written to the Info log", Usage: "If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged",
Value: glog.GetTraceLocation(), Value: glog.GetTraceLocation(),
} }
PProfEanbledFlag = cli.BoolFlag{ PProfEanbledFlag = cli.BoolFlag{
Name: "pprof", Name: "pprof",
Usage: "Whether the profiling server should be enabled", Usage: "Enable the profiling server on localhost",
} }
PProfPortFlag = cli.IntFlag{ PProfPortFlag = cli.IntFlag{
Name: "pprofport", Name: "pprofport",
@ -174,7 +174,7 @@ var (
// RPC settings // RPC settings
RPCEnabledFlag = cli.BoolFlag{ RPCEnabledFlag = cli.BoolFlag{
Name: "rpc", Name: "rpc",
Usage: "Whether RPC server is enabled", Usage: "Enable the JSON-RPC server",
} }
RPCListenAddrFlag = cli.StringFlag{ RPCListenAddrFlag = cli.StringFlag{
Name: "rpcaddr", Name: "rpcaddr",
@ -194,7 +194,7 @@ var (
// Network Settings // Network Settings
MaxPeersFlag = cli.IntFlag{ MaxPeersFlag = cli.IntFlag{
Name: "maxpeers", Name: "maxpeers",
Usage: "Maximum number of network peers", Usage: "Maximum number of network peers (network disabled if set to 0)",
Value: 16, Value: 16,
} }
ListenPortFlag = cli.IntFlag{ ListenPortFlag = cli.IntFlag{
@ -204,7 +204,7 @@ var (
} }
BootnodesFlag = cli.StringFlag{ BootnodesFlag = cli.StringFlag{
Name: "bootnodes", Name: "bootnodes",
Usage: "Space-separated enode URLs for discovery bootstrap", Usage: "Space-separated enode URLs of initial peers to connect to",
Value: "", Value: "",
} }
NodeKeyFileFlag = cli.StringFlag{ NodeKeyFileFlag = cli.StringFlag{
@ -217,12 +217,12 @@ var (
} }
NATFlag = cli.StringFlag{ NATFlag = cli.StringFlag{
Name: "nat", Name: "nat",
Usage: "Port mapping mechanism (any|none|upnp|pmp|extip:<IP>)", Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
Value: "any", Value: "any",
} }
WhisperEnabledFlag = cli.BoolFlag{ WhisperEnabledFlag = cli.BoolFlag{
Name: "shh", Name: "shh",
Usage: "Whether the whisper sub-protocol is enabled", Usage: "Enable whisper",
} }
JSpathFlag = cli.StringFlag{ JSpathFlag = cli.StringFlag{
Name: "jspath", Name: "jspath",