Skip to content

Don't remove [] from type names #733

@sdwheeler

Description

@sdwheeler

Summary of the new feature / enhancement

During initial design work with Jim we decided that we should remove the [] from type names in the INPUTS and OUTPUTS section of CommandHelp. See the following code.

// We don't want to return any arrays, so trim the last "[]" if it is found;
// We can also simplify the string if desired.
private string GetAdjustedTypename(Type t, bool simplify = false)
{
string tName = simplify ? LanguagePrimitives.ConvertTo<string>(t) : t.FullName;
if (tName.EndsWith("[]"))
{
tName = FixUpTypeName(tName);
}
return tName;
}

Proposed technical implementation details (optional)

Remove the code that removes the [] from the type name.

After further review of existing content, there are cases where it can be important to distinguish between input that can take a collection and also take a singleton on a different parameter. For example, Find-Script has 4 parameters that can take pipeline input for string values.

(gcm Find-Script).Parameters.Values | where {$_.Name -match 'Name|Version$'} | select name,parametertype

Name            ParameterType
----            -------------
Name            System.String[]
MinimumVersion  System.String
MaximumVersion  System.String
RequiredVersion System.String

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions