@@ -19,11 +19,11 @@ public static IEnumerable<string> GetLines(this string text)
1919 /// </summary>
2020 public static Range ToRange ( this IScriptExtent extent )
2121 {
22- return new Range (
23- extent . StartLineNumber ,
24- extent . StartColumnNumber ,
25- extent . EndLineNumber ,
26- extent . EndColumnNumber ) ;
22+ return new Range (
23+ extent . StartLineNumber ,
24+ extent . StartColumnNumber ,
25+ extent . EndLineNumber ,
26+ extent . EndColumnNumber ) ;
2727 }
2828
2929 public static ParameterAst [ ] GetParameterAsts (
@@ -59,7 +59,7 @@ public static AttributeAst GetCmdletBindingAttributeAst(this ParamBlockAst param
5959
6060 foreach ( var attributeAst in attributeAsts )
6161 {
62- if ( attributeAst != null && attributeAst . IsCmdletBindingAttributeAst ( ) )
62+ if ( attributeAst != null && attributeAst . IsCmdletBindingAttributeAst ( ) )
6363 {
6464 return attributeAst ;
6565 }
@@ -72,5 +72,27 @@ public static bool IsCmdletBindingAttributeAst(this AttributeAst attributeAst)
7272 {
7373 return attributeAst . TypeName . GetReflectionAttributeType ( ) == typeof ( CmdletBindingAttribute ) ;
7474 }
75+
76+ public static NamedAttributeArgumentAst GetSupportsShouldProcessAst ( this AttributeAst attributeAst )
77+ {
78+ if ( ! attributeAst . IsCmdletBindingAttributeAst ( )
79+ || attributeAst . NamedArguments == null )
80+ {
81+ return null ;
82+ }
83+
84+ foreach ( var namedAttrAst in attributeAst . NamedArguments )
85+ {
86+ if ( namedAttrAst != null
87+ && namedAttrAst . ArgumentName . Equals (
88+ "SupportsShouldProcess" ,
89+ StringComparison . OrdinalIgnoreCase ) )
90+ {
91+ return namedAttrAst ;
92+ }
93+ }
94+
95+ return null ;
96+ }
7597 }
7698}
0 commit comments