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

example in README doesn't match currently released version of swift-argument-parser #497

Closed
2 tasks done
heckj opened this issue Sep 22, 2022 · 2 comments · Fixed by #498
Closed
2 tasks done

example in README doesn't match currently released version of swift-argument-parser #497

heckj opened this issue Sep 22, 2022 · 2 comments · Fixed by #498

Comments

@heckj
Copy link

heckj commented Sep 22, 2022

The example in the README and main branch of the project doesn't match the code that's currently released, resulting in a rather confusing compilation error.

ArgumentParser version: 1.1.4
Swift version::

swift-driver version: 1.62.14 Apple Swift version 5.7.1 (swiftlang-5.7.1.131.4 clang-1400.0.29.51)
Target: arm64-apple-macosx12.0

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

The example in the README for Repeat explicitly uses the the new functionality for providing optional values, that was merged with #480. I grabbed the sample directly to stub in code into my repo, and got a sequence of confusing messages from Xcode about it not working, until I finally tracked down the details to the optional being a newer feature than the 1.1.4 release provided.

I wasn't sure how long until this project was thinking about releasing the next update, so I wanted to open this bug.

The error messages when you explicitly set @optional to nil are:

Type '...yourAppName...' does not conform to protocol 'Decodable'
and
Referencing initializer 'init(wrappedValue:name:parsing:help:completion:)' on 'Option' requires that 'Int?' conform to 'ExpressibleByArgument'

This would be pretty quickly resolved by putting out a point release that includes that lovely optional setup that was merged after the last release, which I'd like to suggest. In the meantime, newcomers (and clueless folks like me) might take the README as reflection the currently released code and be very confused.

@natecook1000
Copy link
Member

Thanks for the issue, @heckj! I've reverted the README code sample change, so that it builds under what's in the current release. We can add it back when the next release is out, which will be 1.2.0, since it includes new API like the one that enables this improved syntax.

@heckj
Copy link
Author

heckj commented Sep 23, 2022

Thank you. I wish it hadn't thrown me for a loop, but I figured that since it did, it might be worth mentioning. Glad it was an easy change up

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 a pull request may close this issue.

2 participants