yargs / yargs/yargs-parser

Alias single letter to negated boolean option

Open
#406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
519
Forks
129
Avg merge
1h 34m
Merged PRs (30d)
1

Description

I want to have --test set test: true but then also have an alias -T set test: false. Can I do this with yargs? I tried this:

> parser = require('yargs-parser')
> parser('-T', {alias: {T: 'no-test'}, boolean: ['test']})
{ _: [], T: true, 'no-test': true, noTest: true }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the yargs-parser example with --test, -T, alias, and boolean options. Trace how aliases and negated boolean options are handled, then define the expected result: --test sets test to true while -T sets it to false, with tests covering both forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.