v2.9.0 8ebdfe0

install.sh RawHistoryFolder

1#!/bin/sh
2set -e
3
4# Gordon installer script
5# Usage: curl -fsSL https://gordon.bnema.dev/install | bash
6# Usage with pre-release: curl -fsSL https://gordon.bnema.dev/install | GORDON_PRERELEASE=1 bash
7
8REPO="bnema/gordon"
9INSTALL_DIR="/usr/local/bin"
10VERSION="${GORDON_VERSION:-latest}"
11
12echo "Installing Gordon..."
13
14# Detect OS
15OS=$(uname -s | tr '[:upper:]' '[:lower:]')
16case "$OS" in
17    linux)
18        OS="linux"
19        ;;
20    darwin)
21        OS="darwin"
22        ;;
23    *)
24        echo "Error: Unsupported operating system: $OS"
25        exit 1
26        ;;
27esac
28
29# Detect architecture
30ARCH=$(uname -m)
31case "$ARCH" in
32    x86_64|amd64)
33        ARCH="amd64"
34        ;;
35    aarch64|arm64)
36        ARCH="arm64"
37        ;;
38    *)
39        echo "Error: Unsupported architecture: $ARCH"
40        exit 1
41        ;;
42esac
43
44echo "Detected: ${OS}/${ARCH}"
45
46# Construct download URL
47TARBALL="gordon_${OS}_${ARCH}.tar.gz"
48
49# Determine version to download
50if [ "$VERSION" = "latest" ] && [ -n "$GORDON_PRERELEASE" ]; then
51    echo "Finding latest pre-release..."
52    # Get latest release (including pre-releases) from GitHub API
53    RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases?per_page=1" 2>/dev/null || echo "")
54    if [ -z "$RELEASE_DATA" ]; then
55        echo "Error: Failed to fetch release information from GitHub API"
56        exit 1
57    fi
58    VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/')
59    if [ -z "$VERSION" ]; then
60        echo "Error: Could not determine latest pre-release version"
61        exit 1
62    fi
63    echo "Using pre-release version: ${VERSION}"
64elif [ "$VERSION" = "latest" ]; then
65    VERSION="latest"
66    echo "Using latest stable release"
67else
68    echo "Using version: ${VERSION}"
69fi
70
71DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${TARBALL}"
72
73# Create temporary directory
74TMP_DIR=$(mktemp -d)
75trap 'rm -rf "$TMP_DIR"' EXIT
76
77# Download checksums file
78CHECKSUMS_URL="https://github.com/${REPO}/releases/download/${VERSION}/checksums.txt"
79echo "Downloading checksums..."
80if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then
81    echo "Error: Failed to download checksums file"
82    exit 1
83fi
84
85echo "Downloading ${TARBALL}..."
86if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"; then
87    echo "Error: Failed to download ${TARBALL}"
88    exit 1
89fi
90
91# Verify checksum
92echo "Verifying checksum..."
93EXPECTED_CHECKSUM=$(grep -E "[[:space:]]${TARBALL}\$" "$TMP_DIR/checksums.txt" | awk '{print $1}')
94if [ -z "$EXPECTED_CHECKSUM" ]; then
95    echo "Error: Could not find checksum for ${TARBALL} in checksums.txt"
96    exit 1
97fi
98
99# Calculate actual checksum (works on both Linux and macOS)
100if command -v sha256sum >/dev/null 2>&1; then
101    ACTUAL_CHECKSUM=$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')
102elif command -v shasum >/dev/null 2>&1; then
103    ACTUAL_CHECKSUM=$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')
104else
105    echo "Error: Neither 'sha256sum' nor 'shasum' was found. Cannot verify checksum."
106    echo ""
107    echo "Please install one of these tools:"
108    echo "  Debian/Ubuntu: sudo apt-get install coreutils"
109    echo "  Fedora/RHEL:   sudo dnf install coreutils"
110    echo "  Alpine:        apk add coreutils"
111    echo "  macOS:         shasum should be pre-installed"
112    exit 1
113fi
114
115if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
116    echo "Error: Checksum verification failed!"
117    echo "Expected: $EXPECTED_CHECKSUM"
118    echo "Actual:   $ACTUAL_CHECKSUM"
119    echo "The downloaded file may be corrupted or tampered with."
120    exit 1
121fi
122echo "Checksum verified successfully."
123
124echo "Extracting..."
125tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"
126
127echo "Installing to ${INSTALL_DIR}..."
128if [ -w "$INSTALL_DIR" ]; then
129    mv "$TMP_DIR/gordon" "$INSTALL_DIR/gordon"
130else
131    echo "sudo required to install to ${INSTALL_DIR}"
132    sudo mv "$TMP_DIR/gordon" "$INSTALL_DIR/gordon"
133fi
134
135# Verify installation
136if command -v gordon >/dev/null 2>&1; then
137    echo ""
138    echo "Gordon installed successfully!"
139    gordon version
140else
141    echo ""
142    echo "Installation complete. You may need to add ${INSTALL_DIR} to your PATH."
143fi

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close