sindresorhus / meow

🐈 CLI app helper
MIT License
3.53k stars 150 forks source link

When flag name and alias name are the same, the flags object does not contain this property even with default #174

Closed GentileFulvio closed 2 years ago

GentileFulvio commented 3 years ago
import * as meow from 'meow';

const cli = meow(
    `
    Usage
      $ test <input>

    Options
      --concurrency, -c  C

    Examples
      $ test --concurrency=5
`,
    {
        flags: {
            concurrency: {
                type: 'number',
                alias: 'c',
                default: 5
            },
            cwd: {
                type: 'string',
                alias: 'cwd',
                default: process.cwd()
            }
        }
    }
);

cli.flags.cwd is undefined.

sindresorhus commented 3 years ago

Why are you defining alias the same as the flag name?

Caesarovich commented 2 years ago

@GentileFulvio The alias option is optional. If you don't have any alias different than the command's name, there is no point defining it.

@sindresorhus I think this can be closed considering lack of activity and high probabilities that the option was just misunderstood.