File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ function New-ParameterTreeNode
35
35
$node | Add-Member - Type NoteProperty - Name Parent - Value $Parent ;
36
36
$node | Add-Member - Type NoteProperty - Name IsListItem - Value $false ;
37
37
$node | Add-Member - Type NoteProperty - Name AllStrings - Value $false ;
38
+ $node | Add-Member - Type NoteProperty - Name OneStringList - Value $false ;
38
39
$node | Add-Member - Type NoteProperty - Name Properties - Value @ ();
39
40
$node | Add-Member - Type NoteProperty - Name SubNodes - Value @ ();
40
41
@@ -72,6 +73,10 @@ function Create-ParameterTreeImpl
72
73
{
73
74
$treeNode.AllStrings = $true ;
74
75
}
76
+ elseif (Contains- OnlyStringList $TypeInfo )
77
+ {
78
+ $treeNode.OneStringList = $true ;
79
+ }
75
80
76
81
$padding = ($Depth.ToString () + (' ' * (4 * ($Depth + 1 ))));
77
82
if ($Depth -gt 0 )
@@ -83,6 +88,10 @@ function Create-ParameterTreeImpl
83
88
{
84
89
$annotation = " *" ;
85
90
}
91
+ elseif ($treeNode.OneStringList )
92
+ {
93
+ $annotation = " ^" ;
94
+ }
86
95
87
96
Write-Verbose ($padding + " [ Node ] " + $treeNode.Name + $annotation );
88
97
Write-Verbose ($padding + " [Parent] " + $Parent.Name );
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ function Generate-CliFunctionCommandImpl
56
56
$methodParamNameList = @ ();
57
57
$methodParamTypeDict = @ {};
58
58
$allStringFieldCheck = @ {};
59
+ $oneStringListCheck = @ {};
59
60
60
61
# 3. CLI Code
61
62
# 3.1 Types
@@ -69,6 +70,8 @@ function Generate-CliFunctionCommandImpl
69
70
$methodParamTypeDict.Add ($paramItem.Name , $paramType );
70
71
$allStringFields = Contains- OnlyStringFields $paramType ;
71
72
$allStringFieldCheck.Add ($paramItem.Name , $allStringFields );
73
+ $oneStringList = Contains- OnlyStringList $paramType ;
74
+ $oneStringListCheck.Add ($paramItem.Name , $oneStringList );
72
75
73
76
if ($paramType.Namespace -like $ModelNameSpace )
74
77
{
Original file line number Diff line number Diff line change @@ -35,4 +35,36 @@ function Contains-OnlyStringFields
35
35
}
36
36
37
37
return $result ;
38
- }
38
+ }
39
+
40
+ function Contains-OnlyStringList
41
+ {
42
+ param (
43
+ [Parameter (Mandatory = $True )]
44
+ [System.Type ]$parameterType
45
+ )
46
+
47
+ if ($parameterType -eq $null )
48
+ {
49
+ return $false ;
50
+ }
51
+
52
+ if ($parameterType.GetProperties ().Count -ne 1 )
53
+ {
54
+ return $false ;
55
+ }
56
+ else
57
+ {
58
+ [System.Reflection.PropertyInfo ]$propInfoItem = ($parameterType.GetProperties ())[0 ];
59
+ if ($propInfoItem.PropertyType.FullName.StartsWith (" System.Collections.Generic.IList" ))
60
+ {
61
+ [System.Type ]$itemType = $propInfoItem.PropertyType.GenericTypeArguments [0 ];
62
+ if ($itemType.IsEquivalentTo ([string ]))
63
+ {
64
+ return $true ;
65
+ }
66
+ }
67
+
68
+ return $false ;
69
+ }
70
+ }
You can’t perform that action at this time.
0 commit comments