Replies: 2 comments
-
I have the same question/issue with some Git commands. E.g. |
Beta Was this translation helpful? Give feedback.
-
I think I am encountering a similar problem. I'm testing using du.exe from Sysinternals. I want the command default to be the equivalent to {
"Name": "Levels",
"OriginalName": "-l",
"Description": "Specify the subdirectory depth.",
"ApplyToExecutable": false,
"ParameterType": "int",
"ParameterSetName": [
"byLevel"
],
"DefaultValue": "1",
"Position": 2147483647,
"OriginalPosition": 0,
"ValueFromPipeline": false,
"ValueFromPipelineByPropertyName": false,
"ValueFromRemainingArguments": false,
"NoGap": false
}, But when I run the other parameter set using `Verbose, I can see that the command is including the level parameter.
The native {
"$schema": "https://aka.ms/PowerShell/Crescendo/Schemas/2022-06",
"Commands": [
{
"Verb": "Get",
"Noun": "FolderUsage",
"OriginalName": "du.exe",
"OriginalCommandElements": [
"-c",
"-nobanner"
],
"Platform": [
"Windows"
],
"Aliases": [
"psdu"
],
"DefaultParameterSetName": "byLevel",
"SupportsShouldProcess": false,
"SupportsTransactions": false,
"NoInvocation": false,
"Description": "Get folder usage statistics",
"Usage": {
"Synopsis": "Get folder usage statistics",
"SupportsFlags": false,
"HasOptions": false
},
"Parameters": [
{
"Name": "Path",
"OriginalName": "",
"Description": "Specify the top-level folder path.",
"DefaultValue": ".",
"ApplyToExecutable": false,
"ParameterType": "string",
"AdditionalParameterAttributes": [
"[ValidateScript({Test-Path $_})]"
],
"Mandatory": false,
"ParameterSetName": [
"byLevel",
"byRoot"
],
"Position": 0,
"OriginalPosition": 1,
"ValueFromPipeline": false,
"ValueFromPipelineByPropertyName": false,
"ValueFromRemainingArguments": false,
"NoGap": false
},
{
"Name": "Levels",
"OriginalName": "-l",
"Description": "Specify the subdirectory depth.",
"ApplyToExecutable": false,
"ParameterType": "int",
"ParameterSetName": [
"byLevel"
],
"DefaultValue": "1",
"Position": 2147483647,
"OriginalPosition": 0,
"ValueFromPipeline": false,
"ValueFromPipelineByPropertyName": false,
"ValueFromRemainingArguments": false,
"NoGap": false
},
{
"Name": "NoRecurse",
"OriginalName": "-n",
"Description": "Do not recurse sub-folders from the specified path.",
"ApplyToExecutable": false,
"ParameterType": "Switch",
"Mandatory": false,
"ParameterSetName": [
"byRoot"
],
"Position": 2147483647,
"OriginalPosition": 0,
"ValueFromPipeline": false,
"ValueFromPipelineByPropertyName": false,
"ValueFromRemainingArguments": false,
"NoGap": false
}
],
"Examples": [
{
"Command": "Get-FolderUsage -Path D:\\",
"OriginalCommand": "du -c -nobanner -l 1 d:\\",
"Description": "Get top level folder usage from D:\\"
},
{
"Command": "Get-FolderUsage -Path C:\\work -NoRecurse",
"OriginalCommand": "du -c -nobanner -n c:\\work",
"Description": "Get folder usage for the root C:\\work"
}
],
"OutputHandlers": [
{
"ParameterSetName": "Default",
"Handler": "$input | ConvertFrom-CSV | Foreach-Object {$_.psobject.typenames.insert(0,\u0022PSDUObject\u0022); $_}",
"HandlerType": "Inline",
"StreamOutput": true
}
]
}
]
} I copied du.exe to C:\Windows. |
Beta Was this translation helpful? Give feedback.
-
Hello all, I am having some issues with parameters mostly right now. For instance I am building a new command for Android ADB which involves pulling device properties.
New Command: Get-ADBProps -Serial f8739hf9
Old Command: adb.exe -s f8739hf9 shell getprop
Now the order in which ADB accepts its arguments must be in order. So the -s f8739hf9 must be before shell getprop. If I use "OriginalCommandElements" for shell and getprop they are always used first, so this is not working. If I add both parameters in as a switch I have to call them on every execution so, Get-ADBProps -Serial f8739hf9 -Shell -GetProp.
Am I missing some other method like "DefaultParameterSetName" that I am not understanding or is this functionality not yet available? I have tried to look through the Schemas and anything else I can find but there is not much documentation out right now. Any support would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions