Skip to content

Commit d2ddf18

Browse files
committed
🔃 Build-App Argument Completer
1 parent ce2ae0a commit d2ddf18

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎Scripts/Build-App.ps1‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,21 @@
66
.PARAMETER ShowDownloadProgress
77
Displays Progress Bar for file download.
88
#>
9+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'argument completer')]
910
param(
1011
[Parameter(Mandatory, ParameterSetName = 'Name', Position = 1)]
1112
[ValidateNotNullOrEmpty()]
13+
[ArgumentCompleter({
14+
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
15+
switch($Parameter){
16+
'AppName' {
17+
$AppsDirectory = Join-Path $PSScriptRoot '../Apps'
18+
$Apps = Get-ChildItem -Path $AppsDirectory -Directory -Exclude '_template' -ErrorAction Stop | ForEach-Object { $_.Name }
19+
$Apps | Where-Object { $_ -like "$WordToComplete*" } | ForEach-Object { "'$_'" } | Sort-Object
20+
}
21+
Default {}
22+
}
23+
})]
1224
[string]$AppName,
1325

1426
[Parameter(ParameterSetName = 'Name', Position = 2)]

0 commit comments

Comments
 (0)