Skip to content

Is it possible to use 'generic' value as the default command? #2

@djalmaaraujo

Description

@djalmaaraujo

Let me try to explain.

I have this CLI:

my-cli something-else
my-cli -h

I want to be able to use what I want as the first argument. Something like this:

// Instead of:
.command('build <entry>')
// just:
.command('<entry>')

is that clear?

A more real example:

prog
    .command('<entry>')
    .describe('List your entries')
    .option('a, --add')
    .action((entry, opts) => {
      console.log('You said:')
      console.log(entry)
     })

I need to be able to run my-cli hello and not only using my-cli a hello

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions