Skip to content

Commit 3658a74

Browse files
Update Linux setup scripts to allow Enter key as default confirmation (Y) (#1294)
* Initial plan * Update Linux setup scripts to allow Enter key as default confirmation (Y) Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> * Fix script logic to only continue on y, Y, or Enter - reject all other input Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> * Update PowerShell setup scripts to allow Enter key as default confirmation (Y) Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> * Update all setup scripts to require single key press and only accept Y/y/Enter Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> Co-authored-by: Waldek Mastykarz <waldek@mastykarz.nl>
1 parent b8e2dfd commit 3658a74

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

scripts/setup-beta.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Write-Host "4. Configure Dev Proxy and its files as executable (Linux and macOS
1818
Write-Host "5. Configure new version notifications for the beta channel"
1919
Write-Host "6. Add the devproxy-beta directory to your PATH environment variable in `$PROFILE.CurrentUserAllHosts"
2020
Write-Host ""
21-
Write-Host "Continue (y/n)? " -NoNewline
22-
$response = [System.Console]::ReadKey().KeyChar
21+
Write-Host "Continue (Y/n)? " -NoNewline
22+
$key = [Console]::ReadKey($true)
23+
$response = $key.KeyChar
2324

24-
if ($response -notin @('y', 'Y')) {
25+
if ($response -notin @('Y', 'y', "`r")) {
2526
Write-Host "`nExiting"
2627
exit 1
2728
}

scripts/setup-beta.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ echo ""
2121

2222
if [ -t 0 ]; then
2323
# Terminal is interactive, prompt the user
24-
read -p "Continue (y/n)? " -n1 -r response
24+
read -p "Continue (Y/n)? " -n1 -r response
25+
if [[ "$response" != "" && "$response" != [yY] && "$response" != $'\n' ]]; then
26+
echo -e "\nExiting"
27+
exit 1
28+
fi
2529
else
2630
# Not interactive
2731
response='y'
2832
fi
2933

30-
if [[ "$response" != [yY] ]]; then
31-
echo -e "\nExiting"
32-
exit 1
33-
fi
34-
3534
if [ -t 0 ]; then
3635
echo -e "\n"
3736
fi

scripts/setup.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ Write-Host "3. Unzip the release in the devproxy directory"
1717
Write-Host "4. Configure devproxy and its files as executable (Linux and macOS only)"
1818
Write-Host "5. Add the devproxy directory to your PATH environment variable in `$PROFILE.CurrentUserAllHosts"
1919
Write-Host ""
20-
Write-Host "Continue (y/n)? " -NoNewline
21-
$response = [System.Console]::ReadKey().KeyChar
20+
Write-Host "Continue (Y/n)? " -NoNewline
21+
$key = [Console]::ReadKey($true)
22+
$response = $key.KeyChar
2223

23-
if ($response -notin @('y', 'Y')) {
24+
if ($response -notin @('Y', 'y', "`r")) {
2425
Write-Host "`nExiting"
2526
exit 1
2627
}

scripts/setup.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ echo ""
2020

2121
if [ -t 0 ]; then
2222
# Terminal is interactive, prompt the user
23-
read -p "Continue (y/n)? " -n1 -r response
23+
read -p "Continue (Y/n)? " -n1 -r response
24+
if [[ "$response" != "" && "$response" != [yY] && "$response" != $'\n' ]]; then
25+
echo -e "\nExiting"
26+
exit 1
27+
fi
2428
else
2529
# Not interactive, set a default response
2630
response='y'
2731
fi
2832

29-
if [[ "$response" != [yY] ]]; then
30-
echo -e "\nExiting"
31-
exit 1
32-
fi
33-
3433
if [ -t 0 ]; then
3534
echo -e "\n"
3635
fi

0 commit comments

Comments
 (0)