Yargs: How would I describe a positional argument?

Created on 30 Jul 2016  路  4Comments  路  Source: yargs/yargs

Let's say that I'm configuring yargs like so:

var argv = require('yargs')
  .usage('Usage: $0 <sourceDir>')
  .demand(1)
  .argv;

How would I .describe the sourceDir argument?

This similar issue discussed positional arguments to commands, but note that I am not using a command here, but rather would like to describe a top-level positional argument.

Most helpful comment

@wearhere we've been talking about adding top-level commands, which I think could address this issue well.

All 4 comments

@wearhere we've been talking about adding top-level commands, which I think could address this issue well.

@bcoe How is the progress of this issue?

@bcoe +1 for this

this is now possible with default commands and .positional() 馃帀

var argv = require('./')
  .usage('$0 <source-dir>', 'performs operation on source-dir', (yargs) => {
    yargs.positional('source-dir', {
      describe: 'this is the source directory'
    })
  })
  .demand(1)
  .argv;

console.info(argv)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nchudleigh picture nchudleigh  路  3Comments

borela picture borela  路  3Comments

atian25 picture atian25  路  4Comments

alexreg picture alexreg  路  4Comments

diesal11 picture diesal11  路  3Comments