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.

Feat: command default value

See original GitHub issue

Allow passing default value to a command.

Currently you can only pass opts.default: true to make the command default to the whole CLI.

Problem comes from the

if (opts.default) this.default = cmd;

Use case:

sade
  .command('run [file]', 'Run your file', {
    default: 'src/index.js',
    // default: true,
    alias: ['r'],
  })
  .example('run')
  .example('run file.js')
  .action((file, argv) => {
    console.log(file); // currently `undefined`
  });

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeedcommented, Nov 12, 2019

That, or this is just one of the few times you’ve found found yourself needing slightly more flexibility (even though there’s no lack of functionality) 😉

1reaction
tunnckoCorecommented, Nov 11, 2019

Sure 😉

I’m of the opinion that JS ecosystem is too loose/too flexible the majority of times, and that’s why it’s hard to piece things together or figure things out. When utilities are big, confusing, unclear, …etc, then you end up with useless tools that need replacing.

Valid point too.

Hm. Just remembered that in the beginning (around 2013) and a few following years I was exactly in that “strict” team. Seems like I loose (pun intended) that through the years and switched teams, haha.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FEAT/UserGuide - FSL - FslWiki
By default BET brain extraction is applied to create a brain mask from the mean volume in the FMRI data. This is normally...
Read more >
Show default values for each command flag #17191 - GitHub
Show default values for each command flag #17191 ... feat(@angular/cli): add default value for options in help #17893.
Read more >
FTP Commands: FEAT, OPTS, HELP, STAT, NLST, XCUP ...
The FEAT command eliminates the need for this type of trial-and-error discovery. Common responses: ... FTP Voyager uses a default value of 6....
Read more >
FT.CREATE - Redis
is default score for documents in the index. Default score is 1.0. SCORE_FIELD {score_attribute}. is document attribute that you use as the document...
Read more >
Configuring a SCCP Test Message
This can be verified by entering the rtrv-feat command. If the gtt value is on , the GTT ... Default value - ANSI...
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