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

Add nullable annotation for boolean field #23

Merged
merged 12 commits into from Nov 26, 2018
Merged

Add nullable annotation for boolean field #23

merged 12 commits into from Nov 26, 2018

Conversation

zolotyh
Copy link
Contributor

@zolotyh zolotyh commented Nov 20, 2018

Now, build_cli can't generate code which matched this:

// file.dart
import 'package:args/args.dart';

void main(Iterable<String> args) {
  final parser = new ArgParser()..addFlag('test', defaultsTo: null, negatable: true);
  final results = parser.parse(args);
  print(results['test']);
}
dart file.dart
// null

I am trying to fix this.

@zolotyh
Copy link
Contributor Author

zolotyh commented Nov 21, 2018

@kevmoo I've fixed the particular case. I can do it for other field types or if you show me another way I can do it as you show me.

@kevmoo
Copy link
Owner

kevmoo commented Nov 21, 2018

@zolotyh – I tweaked some things here. You'll want to sync down master locally.

Please add a test here – at least modify one of the existing examples in the test directory to use this feature.

@zolotyh
Copy link
Contributor Author

zolotyh commented Nov 25, 2018

@kevmoo Thank you for your answer. I've done it. If you have any additional requirements just let me know

Copy link
Owner

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was tempted to say we should add some special nullDefault sentinel or something. But this is cleaner.

Thanks!

@kevmoo kevmoo merged commit 081ded7 into kevmoo:master Nov 26, 2018
@zolotyh
Copy link
Contributor Author

zolotyh commented Nov 27, 2018

@kevmoo Thank you for approving a request. Do you plan to publish a new version to pub?

@kevmoo
Copy link
Owner

kevmoo commented Nov 27, 2018 via email

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

Successfully merging this pull request may close these issues.

None yet

2 participants