Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

feat: Add 'singleValue' flag option to assign only one value per multiple flag #79

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cxam
Copy link

@cxam cxam commented May 18, 2020

This feature aims to address the issue outlined in oclif/oclif#190 to only allow a single value to be assigned for each flag that has the multiple option set. It's a non-breaking change that requires you to include the singleValue boolean in your flag options.

In the command cmd -a foo bar, it's generally accepted that bar becomes a positional argument and should be the default behaviour. Unfortunately, the PR that broke default behaviour has been part of this project for a while now and I feel providing the user an option to change this back would be the best course of action unless a breaking release is planned for oclif.

If this goes through, I'll update and push the relevant changes to the docs repository.

@codecov
Copy link

codecov bot commented May 18, 2020

Codecov Report

Merging #79 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #79   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           1       1           
  Lines          46      29   -17     
  Branches       21      14    -7     
======================================
+ Misses         46      29   -17     
Impacted Files Coverage Δ
src/validate.ts 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfb4423...9de72fb. Read the comment docs.

@vasinov
Copy link

vasinov commented Jun 15, 2020

Any update on this PR? This is a sorely needed improvement.

@srlowe
Copy link

srlowe commented Jun 26, 2020

This seems like a great approach to the fix. Hopefully this gets reviewed and merged soon.

@RasPhilCo
Copy link
Contributor

@cxam thanks for the PR! $ cli foo -a foo bar shouldn't pass bar as a flag. I want to revert that PR's behavior. I'll put this on our project board for looking at next.

@caleblloyd
Copy link

caleblloyd commented Oct 8, 2020

I have created a patch of this PR against v3.8.5, if using yarn, you can add the following yarn resolution to packages.json and get this change today while we wait for this to get merged:

  "resolutions": {
    "@oclif/parser": "https://github.com/caleblloyd/oclif-parser-patch-single-value#v3.8.5"
  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants