Merge b189df348270c16415f353ce6df99d933ee96aa1 into ed745a9acb0d1f2bf765e03d8ee4114d3032b73a

This commit is contained in:
Lemois 1337 2025-03-18 18:18:33 +01:00 committed by GitHub
commit c71d2c14e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,11 @@ func parseConfig() (*configFlags, error) {
parser := flags.NewParser(cfg, flags.PrintErrors|flags.HelpFlag) parser := flags.NewParser(cfg, flags.PrintErrors|flags.HelpFlag)
_, err := parser.Parse() _, err := parser.Parse()
// If special error ErrHelp catched by -h or --help
if ourErr, ok := err.(*flags.Error); ok && ourErr.Type == flags.ErrHelp {
os.Exit(0)
}
// Show the version and exit if the version flag was specified. // Show the version and exit if the version flag was specified.
if cfg.ShowVersion { if cfg.ShowVersion {
appName := filepath.Base(os.Args[0]) appName := filepath.Base(os.Args[0])
@ -78,7 +83,8 @@ func parseConfig() (*configFlags, error) {
} }
if cfg.MiningAddr == "" { if cfg.MiningAddr == "" {
return nil, errors.New("--miningaddr is required") fmt.Fprintln(os.Stderr, errors.New("Error parsing command-line arguments: --miningaddr is required"))
os.Exit(1)
} }
initLog(defaultLogFile, defaultErrLogFile) initLog(defaultLogFile, defaultErrLogFile)