Skip to content

show a sane error message when a user mixes subcommands and options #14

@gregbanks

Description

@gregbanks

it is currently very misleading

> var p = nomnom()
> p.option('foo', {'abbr': 'f', 'help': 'foo'})
> c = p.command('bar')
> c.option('baz', {'abbr': 'b', 'help': 'baz', 'flag': true})
> var args = ['-f', 'foo', 'bar', '-b']
> p.parse(args)
'-b' expects a value


Usage: /Users/Greg/.pyenv/versions/2.7.10/envs/carbonio-dev-env/bin/node undefined <command> [options]

command     one of: bar

Options:
   -f, --foo   foo

here, -b is a flag and should not expect a value

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions