From 7bebe6fd28afd9e6e454c633e0c0c487fcbca48a Mon Sep 17 00:00:00 2001 From: nicozingarelli Date: Thu, 24 May 2018 11:56:19 -0700 Subject: [PATCH] cmd: reformatted comments I changed before to agree with Godoc conventions --- cmd/swarm/config.go | 4 ++-- cmd/swarm/main.go | 3 ++- cmd/utils/customflags.go | 12 ++++++------ cmd/utils/flags.go | 24 ++++++++++++------------ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index d06eee673a..8603a77b76 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -38,7 +38,7 @@ import ( ) var ( - // DumpConfigCommand flag definition for the dumpconfig command + // DumpConfigCommand defines the flag for the dumpconfig command. DumpConfigCommand = cli.Command{ Action: utils.MigrateFlags(dumpConfig), Name: "dumpconfig", @@ -49,7 +49,7 @@ var ( Description: `The dumpconfig command shows configuration values.`, } - // SwarmTomlConfigPathFlag flag definition for the config file command + // SwarmTomlConfigPathFlag defines the flag for the config file command. SwarmTomlConfigPathFlag = cli.StringFlag{ Name: "config", Usage: "TOML configuration file", diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index 47c8f6c8e4..84f5acfadc 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -142,11 +142,12 @@ var ( EnvVar: SWARM_ENV_CORS, } - // DeprecatedEthAPIFlag the following flags are deprecated and should be removed in the future + // DeprecatedEthAPIFlag is deprecated and should be removed in the future. DeprecatedEthAPIFlag = cli.StringFlag{ Name: "ethapi", Usage: "DEPRECATED: please use --ens-api and --swap-api", } + // DeprecatedEnsAddrFlag is deprecated and should be removed in the future. DeprecatedEnsAddrFlag = cli.StringFlag{ Name: "ens-addr", Usage: "DEPRECATED: ENS contract address, please use --ens-api with contract address according to its format", diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index 361319c3ec..e74b4f4c96 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -31,9 +31,9 @@ import ( "gopkg.in/urfave/cli.v1" ) -// DirectoryString custom type which is registered in the flags library which cli uses for -// argument parsing. This allows us to expand Value to an absolute path when -// the argument is parsed +// DirectoryString is a custom type that is registered in the flags library which cli +// uses for argument parsing. This allows us to expand Value to an absolute path when +// the argument is parsed. type DirectoryString struct { Value string } @@ -47,7 +47,7 @@ func (ds *DirectoryString) Set(value string) error { return nil } -// DirectoryFlag custom cli.Flag type which expand the received string to an absolute path. +// DirectoryFlag is a custom cli.Flag type that expands the received string to an absolute path. // e.g. ~/.ethereum -> /home/username/.ethereum type DirectoryFlag struct { Name string @@ -71,8 +71,8 @@ func eachName(longName string, fn func(string)) { } } -// Apply called by cli library, grabs variable from environment (if in env) -// and adds variable to flag set for parsing. +// Apply grabs variable from environment (if in env) and adds the variable to flagSet for parsing. +// It is called by cli library. func (df DirectoryFlag) Apply(set *flag.FlagSet) { eachName(df.Name, func(name string) { set.Var(&df.Value, df.Name, df.Usage) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index aff9c4d78f..1527a9b77c 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -112,7 +112,7 @@ func NewApp(gitCommit, usage string) *cli.App { // are the same for all commands. var ( - // DataDirFlag general settings + // DataDirFlag is the flag for general settings. DataDirFlag = DirectoryFlag{ Name: "datadir", Usage: "Data directory for the databases and keystore", @@ -189,7 +189,7 @@ var ( Name: "lightkdf", Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", } - // DashboardEnabledFlag dashboard settings + // DashboardEnabledFlag is the flag for dashboard settings. DashboardEnabledFlag = cli.BoolFlag{ Name: "dashboard", Usage: "Enable the dashboard", @@ -209,7 +209,7 @@ var ( Usage: "Dashboard metrics collection refresh rate", Value: dashboard.DefaultConfig.Refresh, } - // EthashCacheDirFlag ethash settings + // EthashCacheDirFlag is the flag for ethash settings. EthashCacheDirFlag = DirectoryFlag{ Name: "ethash.cachedir", Usage: "Directory to store the ethash verification caches (default = inside the datadir)", @@ -239,7 +239,7 @@ var ( Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)", Value: eth.DefaultConfig.Ethash.DatasetsOnDisk, } - // TxPoolNoLocalsFlag transaction pool settings + // TxPoolNoLocalsFlag is the flag for transaction pool settings. TxPoolNoLocalsFlag = cli.BoolFlag{ Name: "txpool.nolocals", Usage: "Disables price exemptions for locally submitted transactions", @@ -289,7 +289,7 @@ var ( Usage: "Maximum amount of time non-executable transaction are queued", Value: eth.DefaultConfig.TxPool.Lifetime, } - // CacheFlag performance tuning settings + // CacheFlag is the flag for performance tuning settings. CacheFlag = cli.IntFlag{ Name: "cache", Usage: "Megabytes of memory allocated to internal caching", @@ -310,7 +310,7 @@ var ( Usage: "Number of trie node generations to keep in memory", Value: int(state.MaxTrieCacheGen), } - // MiningEnabledFlag miner settings + // MiningEnabledFlag is the flag for miner settings. MiningEnabledFlag = cli.BoolFlag{ Name: "mine", Usage: "Enable mining", @@ -339,7 +339,7 @@ var ( Name: "extradata", Usage: "Block extra data set by the miner (default = client version)", } - // UnlockedAccountFlag account settings + // UnlockedAccountFlag is the flag for account settings. UnlockedAccountFlag = cli.StringFlag{ Name: "unlock", Usage: "Comma separated list of accounts to unlock", @@ -355,7 +355,7 @@ var ( Name: "vmdebug", Usage: "Record information useful for VM and contract debugging", } - // EthStatsURLFlag logging and debug settings + // EthStatsURLFlag is the flag for logging and debug settings. EthStatsURLFlag = cli.StringFlag{ Name: "ethstats", Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)", @@ -372,7 +372,7 @@ var ( Name: "nocompaction", Usage: "Disables db compaction after import", } - // RPCEnabledFlag RPC settings + // RPCEnabledFlag is the flag for RPC settings. RPCEnabledFlag = cli.BoolFlag{ Name: "rpc", Usage: "Enable the HTTP-RPC server", @@ -443,7 +443,7 @@ var ( Usage: "Comma separated list of JavaScript files to preload into the console", } - // MaxPeersFlag network settings + // MaxPeersFlag is the flag for network settings. MaxPeersFlag = cli.IntFlag{ Name: "maxpeers", Usage: "Maximum number of network peers (network disabled if set to 0)", @@ -500,14 +500,14 @@ var ( Usage: "Restricts network communication to the given IP networks (CIDR masks)", } - // JSpathFlag ATM the url is left to the user and deployment to + // JSpathFlag leaves the url and deployment to the user (for now). JSpathFlag = cli.StringFlag{ Name: "jspath", Usage: "JavaScript root path for `loadScript`", Value: ".", } - // GpoBlocksFlag gas price oracle settings + // GpoBlocksFlag is the flag for gas price oracle settings. GpoBlocksFlag = cli.IntFlag{ Name: "gpoblocks", Usage: "Number of recent blocks to check for gas prices",