Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions launch.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
echo Starting Python Learning App...
echo Syncing dependencies...
call uv sync --group dev
if %errorlevel% neq 0 (
echo Error syncing dependencies. Make sure 'uv' is installed.
pause
goto :eof
)

echo Launching app...
call uv run python-learning session
if %errorlevel% neq 0 (
pause

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the application fails to launch, the script pauses without any message, which could be confusing for the user. It's better to provide an error message indicating that the application exited with an error before pausing.

    echo Application exited with an error.
    pause

)
20 changes: 20 additions & 0 deletions launch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Write-Host "Starting Python Learning App..." -ForegroundColor Cyan

Write-Host "Syncing dependencies..." -ForegroundColor Yellow
try {
uv sync --group dev
if ($LASTEXITCODE -ne 0) {
throw "uv sync failed with exit code $LASTEXITCODE"
}
} catch {
Write-Host "Error syncing dependencies. Make sure 'uv' is installed." -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
Read-Host "Press Enter to quit..."
return
}

Write-Host "Launching app..." -ForegroundColor Green
uv run python-learning session
if ($LASTEXITCODE -ne 0) {
Read-Host "Press Enter to quit..."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the application exits with an error, the script pauses for input without displaying any message. This can be confusing. It would be better to inform the user that an error occurred.

    Write-Host "Application exited with an error." -ForegroundColor Red
    Read-Host "Press Enter to quit..."

}
23 changes: 23 additions & 0 deletions launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Text formatting
CYAN="\033[0;36m"
YELLOW="\033[1;33m"
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color

echo -e "${CYAN}Starting Python Learning App...${NC}"

echo -e "${YELLOW}Syncing dependencies...${NC}"
if ! uv sync --group dev; then
echo -e "${RED}Error syncing dependencies. Make sure 'uv' is installed.${NC}"
read -p "Press Enter to quit..."
kill -INT $$

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using kill -INT $$ to exit the script is unconventional. A simple exit 1 is more idiomatic and clearly communicates the intent to exit with an error status.

Suggested change
kill -INT $$
exit 1

fi

echo -e "${GREEN}Launching app...${NC}"
if ! uv run python-learning session; then
read -p "Press Enter to quit..."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When the application fails, the script pauses without any message, which could be confusing for the user. It's better to add an error message before pausing.

Suggested change
read -p "Press Enter to quit..."
echo -e "${RED}Application exited with an error.${NC}"
read -p "Press Enter to quit..."

kill -INT $$

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As mentioned earlier, using kill -INT $$ is unconventional. Prefer exit 1 for clarity and to follow standard shell scripting practices.

Suggested change
kill -INT $$
exit 1

fi
Loading