how to map multiple keys to aliases in yargs .alias

Viewed 758

Yargs api says about .alias(key, alias):

Optionally .alias() can take an object that maps keys to aliases. Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings.

I tried to find example but i didn't found. can someone give code example of that option?

1 Answers

Is this what you are looking for?

      .alias({
         help: 'h',
         version: 'v'
       })

instead of:

      .alias('help', 'h)
      .alias('version, 'v)
Related