-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Argument Parser migration #14
Argument Parser migration #14
Conversation
7da9a23
to
3bd789e
Compare
Whoa, it's a complete mess by now I've tried to keep the core logic intact as much as possible. Though, there are few minor differences in the error reporting. Now both CLIs are functional with a given priority to swift run -Xswiftc -DARGUMENT_PARSER badgy @arthurpalves would you mind to have a quick glance and decide whether the changes should be served in a more atomic way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So glad this was done! I'm taking notes for my own projects 😄
Sources/Badgy/Commands/Badgy.swift
Outdated
@OptionGroup() | ||
var options: Badgy.Options | ||
|
||
@Option(help: "Rotation angle of the badge") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Degrees? Radians? Percent of a full rotation? What's the default if it's not specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right.
I wonder whether the same should be done to color
and tintColor
🤔
Thank you so much for the thorough review! :) |
specify default position value extract valid positions
restore bottomLeft default position for `small` list supported positions list in help
What a party! 💯 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon merge into rc-argument-parser we can initiate next step to remove support for SwiftCLI
@Option(default: .bottom, help: "Position on which to place the badge. Supported positions: \(Position.longLabelPositions.formatted())") | ||
var position: Position | ||
|
||
@Option(default: 0, help: "The rotation angle of the badge in degrees range of -180 ... 180") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it behave any different with negative values than SwiftCLI?
I've recently seen an issue with it for not really testing before.
Only acceptable when escaped and within single or double quotes
--angle '\-15'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, good catch, haven't thought about it before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a common problem for CLIs :)
Yet, as a workaround: ArgumentParser
handles negative values if =
is used. Example: --angle=-15
Related:
apple/swift-argument-parser#31
apple/swift-argument-parser#153
A first drafts for arguments parser adoption. The meat is somewhere between the first fifty lines of Badgy.swift.
Though, it's a far from done. Just sharing an initial draft and thoughts around it.