-
Notifications
You must be signed in to change notification settings - Fork 340
ArgumentHelp.Visibility levels API #390
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
ArgumentHelp.Visibility levels API #390
Conversation
Some comments:
|
/// the extended help display. | ||
public var shouldDisplay: Bool = true |
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.
I dont think we can eliminate this property since it is part of our public API, but it can be deprecated and forward get/set to the new visibility property you've defined
Same for the initializer below
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.
Indeed, my bad
2c6eaec
to
e2707e0
Compare
I made the modifications to keep and mark the |
set { | ||
visibility = newValue ? .default : .hidden | ||
} | ||
} | ||
|
||
/// Creates a new help instance. | ||
public init( |
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.
Could we add a depreciation to this initializer start moving away from shouldDisplay
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.
Sure!
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.
I marked this initializer as deprecated but didn't provide a deprecation message since I don't any a public alternative for now. However, I just learned (from you :)) about @_disfavoredOverload
, do you think it could be useful here?
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.
I think the message should guide users to ArgumentHelp.init(_:discussion:valueName: visibility:)
. @_disfavoredOverload
probably is needed as well since both inits can be called without providing any arguments.
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.
A message pointing at the new initializer would be great! If you remove the default value for shouldDisplay
, you won't need to use @_disfavoredOverload
.
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.
That's a clever solution!
e2707e0
to
f245342
Compare
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.
Looking good, @McNight! Don't worry about squashing commits, we do that when merging.
set { | ||
visibility = newValue ? .default : .hidden | ||
} | ||
} | ||
|
||
/// Creates a new help instance. | ||
public init( |
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.
A message pointing at the new initializer would be great! If you remove the default value for shouldDisplay
, you won't need to use @_disfavoredOverload
.
@@ -11,6 +11,17 @@ | |||
|
|||
/// Help information for a command-line argument. | |||
public struct ArgumentHelp { | |||
public enum Visibility { |
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.
Could you add an abstract for this type, as well?
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.
Sure !
f245342
to
6357b67
Compare
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.
Changes look good! 👍🏻
@swift-ci Please test |
This reverts commit 4cdcc17.
This pull request (as a draft for now) adds a new
ArgumentHelp.Visibility
API with multiple levels allowing to indicate whether help messages should be shown in the extended help display.It follows suggestions made by @natecook1000 in issue #384.
Checklist