node-getopt icon indicating copy to clipboard operation
node-getopt copied to clipboard

Access to command name

Open MikeTaylor opened this issue 7 years ago • 1 comments

It would be helpful if I could access the command-name (the basename of process.argv[1]) from the opts structure, so I can use it in other error messages. Something like:

opt.parseSystem();
if (!parseFile(opt.argv[0])) {
  console.error(`${opt.command}: could not parse file ${opt.argv[0]}`);
  process.exit(1);
}

MikeTaylor avatar May 17 '18 10:05 MikeTaylor

By the way, can I say that I really appreciate this library, and the way it doesn't try to take over my whole application, just does what I need it to simply and directly. I hope my filing two feature-requests today doesn't come across as ungrateful :-)

MikeTaylor avatar May 17 '18 10:05 MikeTaylor