Skip to content

Commit

Permalink
update powershell script
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiayang committed Mar 11, 2024
1 parent c6da7fe commit 6f815b4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/src/templates/setup.ps1.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ if ($keyboard_type -eq "shield") {
{{/boards}}
}

$boards_revisions = [ordered]@{
{{#boards}}
{{id}} = @({{#revisions}}
"{{.}}"{{/revisions}});
{{/boards}}
}

$boards_default_revision=[ordered]@{
{{#boards}}
{{id}} = "{{{default_revision}}}";
{{/boards}}
}

Write-Host "$title"
Write-Host ""
Write-Host "MCU Board Selection:"
Expand All @@ -145,6 +158,20 @@ if ($keyboard_type -eq "shield") {
$shields = $keyboard_siblings
$board = $($($boards.keys)[$choice])
$boards = ( $board )

if ($($($boards_revisions.values)[$choice]).count -gt 0) {
$valid_revisions = $($($boards_revisions.values)[$choice])
for ($i = 0; $i -lt $valid_revisions.count; $i += 1) {
if ($valid_revisions[$i] -eq $($($boards_default_revision.values)[$choice])) {
$valid_revisions[$i] += " (default)"
}
}

$revision_choice = Get-Choice-From-Options -Options $valid_revisions -Prompt $prompt
$board = $board + "@" + $valid_revisions[$revision_choice]
$boards = ( $board )
}

} else {
$boards = ( $keyboard_siblings )
$shields = @( )
Expand Down

0 comments on commit 6f815b4

Please sign in to comment.