question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi there,

Love the nest-commander package - very helpful to get cli functionality with nestjs 😃

Have hit a slight issue where adding the hint to indicate that a flag is required doest seem to be honoured, is that right or am I using it wrong ly. Example below to hopefully clarify what I mean…

so if i want to make an arg --sample-arg required I should

so according to the docs, using <> should make the flag required

  @Option({
    flags: '-s --sample-arg <sampleArg>',
  })
  parseArg(val: string): string {
    return val;
  }

however i can execute the command above without supplying -s flag so it looks like the option below (using [] syntax) is effectively the same

  @Option({
    flags: '-s --sample-arg [sampleArg]',
  })
  parseArg(val: string): string {
    return val;
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
digitalbananacommented, Jul 30, 2021

ah ok that makes sense - thanks for clarifying…

required option would be super useful, am happy to contribute if want any help but need a pointer of where to begin :-p

0reactions
digitalbananacommented, Sep 3, 2021

awesome thanks @jmcdo29

Read more comments on GitHub >

github_iconTop Results From Across the Web

RequireJS API
You will typically use a data-main script to set configuration options and then load the first application module. Note: the script tag require.js...
Read more >
Node.js "require" function and parameters - Stack Overflow
When you call lib = require("lib.js")(params). You're actually calling lib.js with one parameter containing two properties name app and ...
Read more >
Command-line API | Node.js v19.3.0 Documentation
Options from the command line take precedence over options passed through the ... (Requires Node.js to be built against FIPS-compatible OpenSSL.) ...
Read more >
OPTIONS - HTTP - MDN Web Docs
The HTTP OPTIONS method requests permitted communication options for a given URL or server. A client can specify a URL with this method, ......
Read more >
Command-line interface / Commands - Composer
Appending a + makes it only ignore the upper-bound of the requirements. For example, if a package requires php: ^7 , then the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found