Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgResults should either implement the Map interface or make the options Map accessible #12771

Closed
DartBot opened this issue Aug 26, 2013 · 4 comments
Assignees
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Aug 26, 2013

This issue was originally filed by googlegroups...@kaioa.com


Right now, the options Map is private. ArgResults defines the [] operator to allow Map-like read-only access.

This works fine. However, you end up passing the ArgResults object around, because pulling the values out of that ArgsResult object is quite a bit of work. This is inconvenient when it comes to testing, because creating an ArgResults object is more work than creating a Map.

Also, this kind of dependency is really weird. Whatever that function does, it probably has very little to do with argument parsing. It shouldn't take an ArgsResult object as argument.

@iposva-google
Copy link
Contributor

Added Area-Pkg, Library-Args, Triaged labels.

@anders-sandholm
Copy link
Contributor

Removed Library-Args label.
Added Pkg-Args label.

@munificent
Copy link
Member

I think it would feel weird if ArgResults itself implemented Map. Things like results.values seems odd to me. What might be nice is ArgResults.options was an actual map. Unfortunately, that collides with the current type of .options.

I think what I'd probably like is to change that to a Map. You could then use .options.keys to get the option names. That's a breaking change, though, so I'm going to defer that a bit.


Set owner to @munificent.
Removed Type-Defect, Priority-Unassigned labels.
Added Type-Enhancement, Priority-Medium labels.

@DartBot DartBot added Type-Enhancement area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. labels Jul 2, 2014
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/args#21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants