Skip to content

Commit ce4224b

Browse files
committed
Add Windows support (x86_64 and ARM64)
- Add Windows binaries to download table and PowerShell install instructions - Update install.sh to handle Windows (Git Bash/MSYS2/WSL) with .zip extraction - Add platform-specific PATH guidance
1 parent c5df28c commit ce4224b

2 files changed

Lines changed: 56 additions & 13 deletions

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ Install to a custom directory:
2424
curl -fsSL https://raw.githubusercontent.com/blaumedia/paperhero-cli/master/install.sh | sh -s -- --dir ~/.local/bin
2525
```
2626

27+
### Windows (PowerShell)
28+
29+
```powershell
30+
# Download latest release
31+
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "amd64" }
32+
$release = Invoke-RestMethod "https://api.github.com/repos/blaumedia/paperhero-cli/releases/latest"
33+
$asset = $release.assets | Where-Object { $_.name -eq "paperhero_windows_${arch}.zip" }
34+
Invoke-WebRequest $asset.browser_download_url -OutFile paperhero.zip
35+
Expand-Archive paperhero.zip -DestinationPath "$env:LOCALAPPDATA\paperhero" -Force
36+
Remove-Item paperhero.zip
37+
38+
# Add to PATH (current session)
39+
$env:PATH += ";$env:LOCALAPPDATA\paperhero"
40+
41+
# Add to PATH (permanent, user-level)
42+
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";$env:LOCALAPPDATA\paperhero", "User")
43+
```
44+
2745
### Manual download
2846

2947
Download the binary for your platform from the [Releases](https://github.com/blaumedia/paperhero-cli/releases) page.
@@ -34,14 +52,24 @@ Download the binary for your platform from the [Releases](https://github.com/bla
3452
| Linux | ARM64 | `paperhero_linux_arm64.tar.gz` |
3553
| macOS | Intel | `paperhero_darwin_amd64.tar.gz` |
3654
| macOS | Apple Silicon | `paperhero_darwin_arm64.tar.gz` |
55+
| Windows | x86_64 | `paperhero_windows_amd64.zip` |
56+
| Windows | ARM64 | `paperhero_windows_arm64.zip` |
3757

38-
Extract and move to your PATH:
58+
**Linux / macOS:**
3959

4060
```bash
4161
tar -xzf paperhero_*.tar.gz
4262
sudo mv paperhero /usr/local/bin/
4363
```
4464

65+
**Windows (PowerShell):**
66+
67+
```powershell
68+
Expand-Archive paperhero_windows_amd64.zip -DestinationPath .
69+
Move-Item paperhero.exe C:\Windows\System32\
70+
# Or add the directory to your PATH instead
71+
```
72+
4573
### Verify installation
4674

4775
```bash

install.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ detect_platform() {
4343
ARCH=$(uname -m)
4444

4545
case "$OS" in
46-
linux) OS="linux" ;;
47-
darwin) OS="darwin" ;;
48-
*) error "Unsupported operating system: $OS" ;;
46+
linux) OS="linux" ;;
47+
darwin) OS="darwin" ;;
48+
mingw*|msys*|cygwin*) OS="windows" ;;
49+
*) error "Unsupported operating system: $OS. On Windows, use PowerShell or download manually from GitHub releases." ;;
4950
esac
5051

5152
case "$ARCH" in
@@ -106,8 +107,12 @@ main() {
106107
info "Installing PaperHero CLI ${VERSION}"
107108

108109
# Construct download URL
109-
# Binary naming: paperhero_<os>_<arch> (e.g. paperhero_linux_amd64)
110-
ARCHIVE_NAME="${BINARY_NAME}_${OS}_${ARCH}.tar.gz"
110+
# Binary naming: paperhero_<os>_<arch>.tar.gz (Linux/macOS) or .zip (Windows)
111+
if [ "$OS" = "windows" ]; then
112+
ARCHIVE_NAME="${BINARY_NAME}_${OS}_${ARCH}.zip"
113+
else
114+
ARCHIVE_NAME="${BINARY_NAME}_${OS}_${ARCH}.tar.gz"
115+
fi
111116
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${ARCHIVE_NAME}"
112117
CHECKSUM_URL="https://github.com/${REPO}/releases/download/${VERSION}/checksums.txt"
113118

@@ -147,21 +152,27 @@ main() {
147152

148153
# Extract
149154
info "Extracting..."
150-
tar -xzf "${TMP_DIR}/${ARCHIVE_NAME}" -C "$TMP_DIR"
155+
if [ "$OS" = "windows" ]; then
156+
unzip -q "${TMP_DIR}/${ARCHIVE_NAME}" -d "$TMP_DIR" || error "Extraction failed. Is 'unzip' installed?"
157+
BINARY_FILE="${BINARY_NAME}.exe"
158+
else
159+
tar -xzf "${TMP_DIR}/${ARCHIVE_NAME}" -C "$TMP_DIR"
160+
BINARY_FILE="${BINARY_NAME}"
161+
fi
151162

152163
# Install
153164
if [ -w "$INSTALL_DIR" ] || [ "$NO_SUDO" -eq 1 ]; then
154165
mkdir -p "$INSTALL_DIR"
155-
mv "${TMP_DIR}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
156-
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
166+
mv "${TMP_DIR}/${BINARY_FILE}" "${INSTALL_DIR}/${BINARY_FILE}"
167+
chmod +x "${INSTALL_DIR}/${BINARY_FILE}" 2>/dev/null || true
157168
else
158169
info "Requesting sudo to install to ${INSTALL_DIR}..."
159170
sudo mkdir -p "$INSTALL_DIR"
160-
sudo mv "${TMP_DIR}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
161-
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
171+
sudo mv "${TMP_DIR}/${BINARY_FILE}" "${INSTALL_DIR}/${BINARY_FILE}"
172+
sudo chmod +x "${INSTALL_DIR}/${BINARY_FILE}" 2>/dev/null || true
162173
fi
163174

164-
info "PaperHero CLI ${VERSION} installed to ${INSTALL_DIR}/${BINARY_NAME}"
175+
info "PaperHero CLI ${VERSION} installed to ${INSTALL_DIR}/${BINARY_FILE}"
165176
printf "\n"
166177
printf "${BOLD}Get started:${NC}\n"
167178
printf " paperhero login --api-url <url> --customer-id <id> --email <email> --password <pass>\n"
@@ -171,7 +182,11 @@ main() {
171182
# Verify the binary is on PATH
172183
if ! command -v "$BINARY_NAME" >/dev/null 2>&1; then
173184
warn "${INSTALL_DIR} is not in your PATH. Add it with:"
174-
warn " export PATH=\"${INSTALL_DIR}:\$PATH\""
185+
if [ "$OS" = "windows" ]; then
186+
warn " Add ${INSTALL_DIR} to your system PATH via System Properties > Environment Variables"
187+
else
188+
warn " export PATH=\"${INSTALL_DIR}:\$PATH\""
189+
fi
175190
fi
176191
}
177192

0 commit comments

Comments
 (0)