Skip to content

Commit 97014a0

Browse files
committed
refactor initial processing of simple variable value
1 parent 91b01c7 commit 97014a0

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

PSFramework/bin/PSFramework.dll

0 Bytes
Binary file not shown.

PSFramework/bin/PSFramework.pdb

0 Bytes
Binary file not shown.

PSFramework/bin/PSFramework.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/PSFramework/Parameter/SelectParameter.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace PSFramework.Parameter
77
{
88
/// <summary>
9-
/// Class that automatically parses input chosen for the -Property parameter of Select-PSUObject
9+
/// Class that automatically parses input chosen for the -Property parameter of Select-PSFObject
1010
/// </summary>
1111
public class SelectParameter : ParameterClass
1212
{
@@ -23,17 +23,18 @@ public SelectParameter(string Value)
2323
{
2424
InputObject = Value;
2525

26+
// check if Value is a variable name (i.e. starts with $ and is a single word)
27+
// if so, the variable value is stored in a property with the same name
28+
if (Value.StartsWith("$") && !Value.Contains(" "))
29+
{
30+
Value = Value + " as " + Value.Substring(1);
31+
}
32+
33+
// check if Value is a property name (i.e. is a single word)
2634
if (!Value.Contains(" "))
2735
{
28-
if (Value.StartsWith("$"))
29-
{
30-
Value = Value + " as " + Value.Substring(1);
31-
}
32-
else
33-
{
34-
this.Value = Value;
35-
return;
36-
}
36+
this.Value = Value;
37+
return;
3738
}
3839

3940
#region Process Input

0 commit comments

Comments
 (0)