Fixed duplicated kaspaminer help output

This commit is contained in:
Lemois 1337 2024-02-14 00:19:41 +01:00
parent 5a3b8a0066
commit b189df3482
No known key found for this signature in database
GPG Key ID: FF99B0E15DBBD9B4

View File

@ -48,6 +48,11 @@ func parseConfig() (*configFlags, error) {
parser := flags.NewParser(cfg, flags.PrintErrors|flags.HelpFlag)
_, 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.
if cfg.ShowVersion {
appName := filepath.Base(os.Args[0])
@ -78,7 +83,8 @@ func parseConfig() (*configFlags, error) {
}
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)