mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
show-deprecated-flags command cleaned up
This commit is contained in:
parent
c69c3756d7
commit
2ad9cbc11e
3 changed files with 20 additions and 36 deletions
|
|
@ -239,6 +239,7 @@ func init() {
|
|||
dumpConfigCommand,
|
||||
// See retesteth.go
|
||||
retestethCommand,
|
||||
// See cmd/utils/flags_legacy.go
|
||||
utils.ShowDeprecated,
|
||||
}
|
||||
sort.Sort(cli.CommandsByName(app.Commands))
|
||||
|
|
@ -462,7 +463,6 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||
if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.IsSet(utils.MinerGasPriceFlag.Name) {
|
||||
gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.Name)
|
||||
log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice")
|
||||
}
|
||||
ethereum.TxPool().SetGasPrice(gasprice)
|
||||
|
||||
|
|
|
|||
|
|
@ -261,6 +261,10 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
},
|
||||
{
|
||||
Name: "MISC",
|
||||
Flags: []cli.Flag{
|
||||
utils.SnapshotFlag,
|
||||
cli.HelpFlag,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -311,29 +315,6 @@ func init() {
|
|||
originalHelpPrinter := cli.HelpPrinter
|
||||
cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
|
||||
if tmpl == AppHelpTemplate {
|
||||
// Iterate over all the flags and add any uncategorized ones
|
||||
categorized := make(map[string]struct{})
|
||||
for _, group := range AppHelpFlagGroups {
|
||||
for _, flag := range group.Flags {
|
||||
categorized[flag.String()] = struct{}{}
|
||||
}
|
||||
}
|
||||
var uncategorized []cli.Flag
|
||||
for _, flag := range data.(*cli.App).Flags {
|
||||
if _, ok := categorized[flag.String()]; !ok {
|
||||
uncategorized = append(uncategorized, flag)
|
||||
}
|
||||
}
|
||||
if len(uncategorized) > 0 {
|
||||
// Append all ungategorized options to the misc group
|
||||
miscs := len(AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags)
|
||||
AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags = append(AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags, uncategorized...)
|
||||
|
||||
// Make sure they are removed afterwards
|
||||
defer func() {
|
||||
AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags = AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags[:miscs]
|
||||
}()
|
||||
}
|
||||
// Render out custom usage screen
|
||||
originalHelpPrinter(w, tmpl, helpData{data, AppHelpFlagGroups})
|
||||
} else if tmpl == utils.CommandHelpTemplate {
|
||||
|
|
|
|||
|
|
@ -29,19 +29,22 @@ var ShowDeprecated = cli.Command{
|
|||
Action: showDeprecated,
|
||||
Name: "show-deprecated-flags",
|
||||
Usage: "Show flags that have been deprecated",
|
||||
Flags: []cli.Flag{
|
||||
LegacyTestnetFlag,
|
||||
LegacyLightServFlag,
|
||||
LegacyLightPeersFlag,
|
||||
LegacyMinerThreadsFlag,
|
||||
LegacyMinerGasTargetFlag,
|
||||
LegacyMinerGasPriceFlag,
|
||||
LegacyMinerEtherbaseFlag,
|
||||
LegacyMinerExtraDataFlag,
|
||||
},
|
||||
ArgsUsage: " ",
|
||||
Category: "MISCELLANEOUS COMMANDS",
|
||||
Description: "Show flags that have been deprecated and will soon be removed",
|
||||
}
|
||||
|
||||
var deprecatedFlags = []cli.Flag{
|
||||
LegacyTestnetFlag,
|
||||
LegacyLightServFlag,
|
||||
LegacyLightPeersFlag,
|
||||
LegacyMinerThreadsFlag,
|
||||
LegacyMinerGasTargetFlag,
|
||||
LegacyMinerGasPriceFlag,
|
||||
LegacyMinerEtherbaseFlag,
|
||||
LegacyMinerExtraDataFlag,
|
||||
}
|
||||
|
||||
var (
|
||||
// (Deprecated April 2018)
|
||||
LegacyMinerThreadsFlag = cli.IntFlag{
|
||||
|
|
@ -148,13 +151,13 @@ var (
|
|||
)
|
||||
|
||||
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
|
||||
func showDeprecated(c *cli.Context) {
|
||||
func showDeprecated(*cli.Context) {
|
||||
fmt.Println("--------------------------------------------------------------------")
|
||||
fmt.Println("The following flags are deprecated and will be removed in the future!")
|
||||
fmt.Println("--------------------------------------------------------------------")
|
||||
fmt.Println()
|
||||
|
||||
for _, flag := range c.Command.Flags {
|
||||
for _, flag := range deprecatedFlags {
|
||||
fmt.Println(flag.String())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue