Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated kaspaminer help output #2267

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/kaspaminer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)
Expand Down