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.

Custom command name in --help?

See original GitHub issue

I named my cli sd in package.json, but here shows the wrong help message Usage: index [options] [command] now the command name is parsed from file name, is there a way to customize it?

$ node cli/index.js -h

  Usage: index [options] [command]


  Commands:

    serve|s   launch exseed app

  Options:

    -h, --help       output usage information
    -V, --version    output the version number
    -e, --env <env>  specify environment (development|test|production)

now the way I fix this is replacing process.argv[1] before program.parse:

process.argv[1] = 'sd';
program.parse(process.argv);

I think there should be another better way

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10

github_iconTop GitHub Comments

11reactions
elliotleelewiscommented, Jul 19, 2017

You can use the .name method on your program object. Like so…

program
    .name('test')
    .usage('<src>');

Then the output would be:

Usage: test <src>

Hope this helps 😀

1reaction
dienluongcommented, Feb 2, 2018

I was trying to figure this out too. The API documentation didn’t help because it was so dated. I would update it myself (at least the name() part) if I knew how to access the source.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Command Name - Typer - tiangolo
Typer, build great CLIs. Easy to code. Based on Python type hints.
Read more >
Custom Commands - Cypress Documentation
Cypress comes with its own API for creating custom commands and overwriting existing commands. The built in Cypress commands use the very same...
Read more >
add_custom_command — CMake 3.25.1 Documentation
This defines a command to generate specified OUTPUT file(s). A target created in the same directory ( CMakeLists.txt file) that specifies any output...
Read more >
Custom Commands - Garden documentation
The custom commands come up when you run garden help , which helps make your project easier ... Commands cannot have the same...
Read more >
Custom commands | Nushell
def "custom command" [] { "this is a custom command with a space in the name!" } # Parameter types. When defining custom...
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