Skip to content

Commit 8cf1ace

Browse files
author
James Brundage
committed
[CommandAST].AsSentence : Prioritizing aliases over parameters (Fixes #260)
1 parent 326fb58 commit 8cf1ace

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Types/CommandAST/AsSentence.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,20 @@ foreach ($potentialCommand in $potentialCommands) {
258258
# Walk over each potential parameter in the command
259259
foreach ($potentialParameter in $potentialParameters.Values) {
260260
$parameterFound = $(
261+
# otherwise, we have to check each alias.
262+
:nextAlias foreach ($potentialAlias in $potentialParameter.Aliases) {
263+
if ($potentialBarewordList -contains $potentialAlias) {
264+
$potentialParameterName = $potentialAlias
265+
$true
266+
break
267+
}
268+
}
269+
261270
# If the parameter name matches,
262271
if ($potentialBarewordList -contains $potentialParameter.Name) {
263272
$true # we've found it,
264273
} else {
265-
# otherwise, we have to check each alias.
266-
:nextAlias foreach ($potentialAlias in $potentialParameter.Aliases) {
267-
if ($potentialBarewordList -contains $potentialAlias) {
268-
$potentialParameterName = $potentialAlias
269-
$true
270-
break
271-
}
272-
}
274+
273275
}
274276
)
275277

0 commit comments

Comments
 (0)