Skip to content

List values, shorthand flag with more than 1 character values #908

@flyfishMT

Description

@flyfishMT

I am having some issues, I may just not understand how this works. This is on windows 10.

Lists

program
.option('-c, --components <components>', 'List of components to create')
.parse(process.argv);

Test
index.js --components dir\one dir\two

Expected results:
program.components = ["dir\\one", "dir\\two"]
Actual:
program.components = "dir\\one";

Shorthand flag, more than one character:

program
  .option('-tf, --testfolder [testfolder]', 'Description')
  .parse(process.argv);

index.js --testfolder somefolder
Results
program.testfolder = "somefolder"

index.js -tf somefolder
Results
program.testfolder = undefined

However, with a single char:

program
  .option('-x, --testfolder [testfolder]', 'Description')
  .parse(process.argv);

index.js -x somefolder
Results
program.testfolder = "somefolder"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions