Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Provide a means to error/exit manually post parse #63

Open
felixSchl opened this issue Jul 13, 2016 · 0 comments
Open

Provide a means to error/exit manually post parse #63

felixSchl opened this issue Jul 13, 2016 · 0 comments

Comments

@felixSchl
Copy link
Owner

Currently only a failed argv parse will print the error and the short help. There ought to be a way for users to fail post-mortem using the same format.

For example:

const argv = neodoc.run(`usage: cp <from> <to>`);
if (!fs.existsSync(argv['<from>'])) {
  neodoc.exit(`file does not exist: ${argv['<from>']}`);
}

should somehow print:

> ./cp some-file.txt
cp: file does not exist: some-file.txt

The only quirk here is that the program name needs to be known. So either it must be stored in argv, maybe as some reserved property and passed manually to neodoc.exit, or ... ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant