Skip to content

Problems in dart:args with camelCase keys #4590

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

Closed
DartBot opened this issue Aug 19, 2012 · 4 comments
Closed

Problems in dart:args with camelCase keys #4590

DartBot opened this issue Aug 19, 2012 · 4 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.

Comments

@DartBot
Copy link

DartBot commented Aug 19, 2012

This issue was originally filed by [email protected]


What steps will reproduce the problem?

import('dart:args');

void main() {
  var keys = [ "upper_case", "camelCase", "camelcase" ];

  for(var key in keys) {
    var parser = new ArgParser();
    parser.addOption(key, defaultsTo: '');
    var res = parser.parse(["--$key", "hasValue"]);
    var value = res[key];
    print('$key: $value');
  }
}

What is the expected output?
upper_case: hasValue
camelCase: hasValue
camelcase: hasValue

What do you see instead?
upper_case: hasValue
camelCase:
camelcase: hasValue

@larsbak
Copy link

larsbak commented Aug 21, 2012

Set owner to @munificent.
Added Area-Library label.

@larsbak
Copy link

larsbak commented Aug 21, 2012

Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Sep 27, 2012

This comment was originally written by @butlermatt


I was going to make an attempt at this. But it appears that this has already been resolved.

In SDK build: 12784 (64-Bit Linux)

The following code works as expected:
#import('packages/args/args.dart');

void main() {
  var keys = [ "upper_case", "camelCase", "camelcase" ];
  var parser = new ArgParser();
  for(var key in keys) {
    parser.addOption(key, defaultsTo: '');
  }
  
  var res = parser.parse(['--upper_case', 'hasValue', '--camelCase', 'hasValue',
                          '--camelcase', 'hasValue']);
  var opts = res.options;
  for(var val in opts) {
    print('$val: ${res[val]}');
  }
}

== Output ==
upper_case: hasValue
camelCase: hasValue
camelcase: hasValue
============

@munificent
Copy link
Member

Cool, thanks for looking into it! I'll close it then.


Added Fixed label.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Sep 28, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
Projects
None yet
Development

No branches or pull requests

3 participants