Skip to content

Commit 91b01c7

Browse files
committed
support non-object variables as additional property in Select-PSFObject
`Select-PSObject` from variable? #661
1 parent aab5bf9 commit 91b01c7

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

PSFramework/bin/PSFramework.dll

0 Bytes
Binary file not shown.

PSFramework/bin/PSFramework.pdb

4 KB
Binary file not shown.

library/PSFramework/Parameter/SelectParameter.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ public SelectParameter(string Value)
2525

2626
if (!Value.Contains(" "))
2727
{
28-
this.Value = Value;
29-
return;
28+
if (Value.StartsWith("$"))
29+
{
30+
Value = Value + " as " + Value.Substring(1);
31+
}
32+
else
33+
{
34+
this.Value = Value;
35+
return;
36+
}
3037
}
3138

3239
#region Process Input
@@ -119,7 +126,16 @@ public SelectParameter(string Value)
119126
}
120127

121128
if (propertyName != ".")
122-
stringValue = String.Format("{0}.{1}", stringValue, valueName);
129+
{
130+
if (valueName.StartsWith("$"))
131+
{
132+
stringValue = valueName;
133+
}
134+
else
135+
{
136+
stringValue = String.Format("{0}.{1}", stringValue, valueName);
137+
}
138+
}
123139

124140
// <guid> = $_
125141
// "(<size>(<cast>(<value>))<sizeName>)"

0 commit comments

Comments
 (0)