Skip to content

how to set usage/help message for errors (e.g. Unrecognized option: -optionx) #33

Answered by ko1nksm
geneliu asked this question in Q&A
Discussion options

You must be logged in to vote

Is this what you mean?

parser_definition() {
  setup   REST help:usage error:error
  ...
}

error() {
	usage
	return 1 # if you want to suppress the default message
}

Alternative

parser_definition() {
  setup   REST help:usage error:usage # <---
  # Use `error:"usage && false"` if you want to suppress the default message
  ...
}

# no error handler

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@geneliu
Comment options

Answer selected by geneliu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants