Skip to content

Commit

Permalink
Fix command line help (erigontech#6052)
Browse files Browse the repository at this point in the history
Postfix after PR erigontech#6047.
  • Loading branch information
yperbasis authored and michaelneuder committed Nov 20, 2022
1 parent 1c894b3 commit 9d06a6e
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ package utils
import (
"crypto/ecdsa"
"fmt"
"io"
"math/big"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"text/tabwriter"
"text/template"

"github.com/c2h5oh/datasize"
"github.com/ledgerwatch/erigon-lib/common/cmp"
Expand Down Expand Up @@ -59,32 +56,6 @@ import (
"github.com/ledgerwatch/erigon/params/networkname"
)

func init() {
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
VERSION:
{{.Version}}
COMMANDS:
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}{{if .Flags}}
GLOBAL OPTIONS:
{{range .Flags}}{{.}}
{{end}}{{end}}
`
cli.HelpPrinter = printHelp
}

func printHelp(out io.Writer, templ string, data interface{}) {
funcMap := template.FuncMap{"join": strings.Join}
t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
w := tabwriter.NewWriter(out, 38, 8, 2, ' ', 0)
if err := t.Execute(w, data); err != nil {
panic(err)
}
w.Flush()
}

// These are all the command line flags we support.
// If you add to this list, please remember to include the
// flag in the appropriate command definition.
Expand Down

0 comments on commit 9d06a6e

Please sign in to comment.