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,
|
dumpConfigCommand,
|
||||||
// See retesteth.go
|
// See retesteth.go
|
||||||
retestethCommand,
|
retestethCommand,
|
||||||
|
// See cmd/utils/flags_legacy.go
|
||||||
utils.ShowDeprecated,
|
utils.ShowDeprecated,
|
||||||
}
|
}
|
||||||
sort.Sort(cli.CommandsByName(app.Commands))
|
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)
|
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||||
if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.IsSet(utils.MinerGasPriceFlag.Name) {
|
if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.IsSet(utils.MinerGasPriceFlag.Name) {
|
||||||
gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.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)
|
ethereum.TxPool().SetGasPrice(gasprice)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,10 @@ var AppHelpFlagGroups = []flagGroup{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "MISC",
|
Name: "MISC",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
utils.SnapshotFlag,
|
||||||
|
cli.HelpFlag,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,29 +315,6 @@ func init() {
|
||||||
originalHelpPrinter := cli.HelpPrinter
|
originalHelpPrinter := cli.HelpPrinter
|
||||||
cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
|
cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
|
||||||
if tmpl == AppHelpTemplate {
|
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
|
// Render out custom usage screen
|
||||||
originalHelpPrinter(w, tmpl, helpData{data, AppHelpFlagGroups})
|
originalHelpPrinter(w, tmpl, helpData{data, AppHelpFlagGroups})
|
||||||
} else if tmpl == utils.CommandHelpTemplate {
|
} else if tmpl == utils.CommandHelpTemplate {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,12 @@ var ShowDeprecated = cli.Command{
|
||||||
Action: showDeprecated,
|
Action: showDeprecated,
|
||||||
Name: "show-deprecated-flags",
|
Name: "show-deprecated-flags",
|
||||||
Usage: "Show flags that have been deprecated",
|
Usage: "Show flags that have been deprecated",
|
||||||
Flags: []cli.Flag{
|
ArgsUsage: " ",
|
||||||
|
Category: "MISCELLANEOUS COMMANDS",
|
||||||
|
Description: "Show flags that have been deprecated and will soon be removed",
|
||||||
|
}
|
||||||
|
|
||||||
|
var deprecatedFlags = []cli.Flag{
|
||||||
LegacyTestnetFlag,
|
LegacyTestnetFlag,
|
||||||
LegacyLightServFlag,
|
LegacyLightServFlag,
|
||||||
LegacyLightPeersFlag,
|
LegacyLightPeersFlag,
|
||||||
|
|
@ -38,8 +43,6 @@ var ShowDeprecated = cli.Command{
|
||||||
LegacyMinerGasPriceFlag,
|
LegacyMinerGasPriceFlag,
|
||||||
LegacyMinerEtherbaseFlag,
|
LegacyMinerEtherbaseFlag,
|
||||||
LegacyMinerExtraDataFlag,
|
LegacyMinerExtraDataFlag,
|
||||||
},
|
|
||||||
Description: "Show flags that have been deprecated and will soon be removed",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -148,13 +151,13 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
|
// 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("--------------------------------------------------------------------")
|
||||||
fmt.Println("The following flags are deprecated and will be removed in the future!")
|
fmt.Println("The following flags are deprecated and will be removed in the future!")
|
||||||
fmt.Println("--------------------------------------------------------------------")
|
fmt.Println("--------------------------------------------------------------------")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
for _, flag := range c.Command.Flags {
|
for _, flag := range deprecatedFlags {
|
||||||
fmt.Println(flag.String())
|
fmt.Println(flag.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue