-
Notifications
You must be signed in to change notification settings - Fork 56
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 ArgDisplayName attribute. #144
base: master
Are you sure you want to change the base?
Conversation
} | ||
} | ||
*/ | ||
|
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.
Remove unused code.
PowerArgs/Metadata/ArgDisplayName.cs
Outdated
/// <summary> | ||
/// Use this attribute to customize your property argument's name to display. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Class)] |
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.
AttributeUsageAttribute.AllowMultiple = false
/// Use this attribute to customize your property argument's name to display. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Class)] | ||
public class ArgDisplayName : Attribute, IGlobalArgMetadata |
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.
Attribute class name should end with "Attribute"
@@ -162,6 +162,7 @@ These attributes can be specified on argument properties. PowerArgs uses this me | |||
|
|||
* `[ArgPosition(0)]` This argument can be specified by position (no need for -propName) | |||
* `[ArgShortcut("n")]` Lets the user specify -n | |||
* `[ArgDisplayName("displayName")]` A customized argument property name or action method name to display. |
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 prefer ArgLongName
@adamabdelhamed Any comments or suggestions are welcome :) |
Hi,
as #143, sometimes we need to set argument name different with property name or method name, so I add the ArgDisplayName attribute to do this. The ArgDisplayName attribute can be set to both property and action method. See the DisplayNameTests.cs for the specific usage format.