Skip to content

Commit 14de459

Browse files
committed
Add install script and update installation docs
1 parent 1217df5 commit 14de459

4 files changed

Lines changed: 85 additions & 4 deletions

File tree

LLMS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ willhaben-cli is a command-line tool for creating and managing listings on willh
1111
1. User must have a willhaben.at account
1212
2. User must be logged in: `willhaben login`
1313

14+
## Installation
15+
16+
```bash
17+
curl -fsSL https://raw.githubusercontent.com/tomLadder/willhaben-cli/main/install.sh | sh
18+
```
19+
20+
Pre-built binaries are also available on the [Releases page](https://github.com/tomLadder/willhaben-cli/releases).
21+
1422
## Authentication
1523

1624
```bash

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,18 @@
6767

6868
## Installation
6969

70-
### Prerequisites
70+
### Quick Install (macOS / Linux)
7171

72-
- [Bun](https://bun.sh) v1.0 or higher
72+
```bash
73+
curl -fsSL https://raw.githubusercontent.com/tomLadder/willhaben-cli/main/install.sh | sh
74+
```
75+
76+
Pre-built binaries are also available on the [Releases page](https://github.com/tomLadder/willhaben-cli/releases).
7377

7478
### From Source
7579

80+
**Prerequisites:** [Bun](https://bun.sh) v1.0 or higher
81+
7682
```bash
7783
# Clone the repository
7884
git clone https://github.com/tomLadder/willhaben-cli.git

docs/guide/installation.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# Installation
22

3-
## Prerequisites
3+
## Quick Install (macOS / Linux)
44

5-
- [Bun](https://bun.sh) v1.0 or higher
5+
```bash
6+
curl -fsSL https://raw.githubusercontent.com/tomLadder/willhaben-cli/main/install.sh | sh
7+
```
8+
9+
This will automatically detect your OS and architecture, download the latest release binary, and install it to `/usr/local/bin`.
10+
11+
## GitHub Releases
12+
13+
Pre-built binaries for macOS, Linux, and Windows are available on the [Releases page](https://github.com/tomLadder/willhaben-cli/releases).
14+
15+
Download the binary for your platform, make it executable (`chmod +x`), and move it to a directory in your `PATH`.
616

717
## From Source
818

install.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/sh
2+
set -e
3+
4+
REPO="tomLadder/willhaben-cli"
5+
INSTALL_DIR="/usr/local/bin"
6+
BINARY_NAME="willhaben"
7+
8+
# Detect OS
9+
OS="$(uname -s)"
10+
case "$OS" in
11+
Darwin) OS="darwin" ;;
12+
Linux) OS="linux" ;;
13+
MINGW*|MSYS*|CYGWIN*) OS="windows" ;;
14+
*) echo "Unsupported OS: $OS" && exit 1 ;;
15+
esac
16+
17+
# Detect architecture
18+
ARCH="$(uname -m)"
19+
case "$ARCH" in
20+
x86_64|amd64) ARCH="x64" ;;
21+
arm64|aarch64) ARCH="arm64" ;;
22+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;;
23+
esac
24+
25+
TARGET="${OS}-${ARCH}"
26+
27+
# Windows not supported via this script
28+
if [ "$OS" = "windows" ]; then
29+
echo "Windows is not supported by this installer."
30+
echo "Download the binary manually from: https://github.com/$REPO/releases"
31+
exit 1
32+
fi
33+
34+
# Get latest release tag
35+
echo "Fetching latest release..."
36+
TAG="$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//')"
37+
38+
if [ -z "$TAG" ]; then
39+
echo "Failed to fetch latest release. Check https://github.com/$REPO/releases"
40+
exit 1
41+
fi
42+
43+
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$TAG/willhaben-$TARGET"
44+
45+
echo "Downloading willhaben $TAG for $TARGET..."
46+
TMPFILE="$(mktemp)"
47+
curl -fsSL "$DOWNLOAD_URL" -o "$TMPFILE"
48+
chmod +x "$TMPFILE"
49+
50+
echo "Installing to $INSTALL_DIR/$BINARY_NAME (may require sudo)..."
51+
if [ -w "$INSTALL_DIR" ]; then
52+
mv "$TMPFILE" "$INSTALL_DIR/$BINARY_NAME"
53+
else
54+
sudo mv "$TMPFILE" "$INSTALL_DIR/$BINARY_NAME"
55+
fi
56+
57+
echo "willhaben $TAG installed successfully! Run 'willhaben --help' to get started."

0 commit comments

Comments
 (0)