detached 5041353

install.sh RawHistoryFolder

1#!/bin/sh
2set -e
3
4# Dumber installer script
5# Usage: curl -fsSL https://git.bnema.dev/dumber/raw/main/install.sh | sh
6# Usage with pre-release: curl -fsSL https://git.bnema.dev/dumber/raw/main/install.sh | DUMBER_PRERELEASE=1 sh
7
8REPO="bnema/dumber"
9FORGE="https://git.bnema.dev"
10VERSION="${DUMBER_VERSION:-latest}"
11
12# Prefer ~/.local/bin if it exists and is in PATH, otherwise /usr/local/bin
13if [ -d "$HOME/.local/bin" ]; then
14    INSTALL_DIR="$HOME/.local/bin"
15    case ":$PATH:" in
16        *":$HOME/.local/bin:"*) ;;
17        *) echo "Warning: $HOME/.local/bin is not in your PATH" ;;
18    esac
19else
20    INSTALL_DIR="/usr/local/bin"
21fi
22
23echo "Installing Dumber..."
24
25# Check OS
26OS=$(uname -s | tr '[:upper:]' '[:lower:]')
27if [ "$OS" != "linux" ]; then
28    echo "Error: Only Linux is supported. Detected: $OS"
29    exit 1
30fi
31
32# Check architecture
33ARCH=$(uname -m)
34if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "amd64" ]; then
35    echo "Error: Only x86_64 is supported. Detected: $ARCH"
36    exit 1
37fi
38
39echo "Detected: linux/x86_64"
40
41TARBALL="dumber_linux_x86_64.tar.gz"
42
43# Determine version to download
44if [ "$VERSION" = "latest" ] && [ -n "$DUMBER_PRERELEASE" ]; then
45    echo "Finding latest pre-release..."
46    RELEASE_DATA=$(curl -fsSL "${FORGE}/-/github/api/repos/${REPO}/releases?per_page=100" 2>/dev/null || echo "")
47    if [ -z "$RELEASE_DATA" ]; then
48        echo "Error: Failed to fetch release information from ${FORGE}"
49        exit 1
50    fi
51    # Prefer jq for reliable JSON parsing of RELEASE_DATA into VERSION.
52    # The awk branch is a portability fallback that assumes prerelease and
53    # tag_name appear in the same '{' fragment; JSON strings containing '{'
54    # or API shape changes can break this extraction.
55    if command -v jq >/dev/null 2>&1; then
56        VERSION=$(echo "$RELEASE_DATA" | jq -r '.[] | select(.prerelease == true) | .tag_name' | head -1)
57    else
58        VERSION=$(echo "$RELEASE_DATA" | awk '
59            BEGIN { RS = "{" }
60            /"prerelease"[[:space:]]*:[[:space:]]*true/ {
61                tag = ""
62                if (match($0, /"tag_name"[[:space:]]*:[[:space:]]*"[^"]+"/)) {
63                    tag = substr($0, RSTART, RLENGTH)
64                    sub(/.*"tag_name"[[:space:]]*:[[:space:]]*"/, "", tag)
65                    sub(/".*/, "", tag)
66                }
67                if (tag != "") {
68                    print tag
69                    exit
70                }
71            }
72        ')
73    fi
74    if [ -z "$VERSION" ]; then
75        echo "Error: Could not determine latest pre-release version"
76        exit 1
77    fi
78    echo "Using pre-release version: ${VERSION}"
79elif [ "$VERSION" = "latest" ]; then
80    echo "Using latest stable release"
81    RELEASE_DATA=$(curl -fsSL "${FORGE}/-/github/api/repos/${REPO}/releases/latest" 2>/dev/null || echo "")
82    if [ -z "$RELEASE_DATA" ]; then
83        echo "Error: Failed to fetch latest release information from ${FORGE}"
84        exit 1
85    fi
86    if command -v jq >/dev/null 2>&1; then
87        VERSION=$(echo "$RELEASE_DATA" | jq -r '.tag_name')
88    else
89        VERSION=$(echo "$RELEASE_DATA" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)
90    fi
91    if [ -z "$VERSION" ]; then
92        echo "Error: Could not determine latest stable version"
93        exit 1
94    fi
95    echo "Resolved version: ${VERSION}"
96else
97    echo "Using version: ${VERSION}"
98fi
99
100DOWNLOAD_URL="${FORGE}/dumber/releases/download/${VERSION}/${TARBALL}"
101
102# Create temporary directory
103TMP_DIR=$(mktemp -d)
104trap 'rm -rf "$TMP_DIR"' EXIT
105
106# Download checksums file
107CHECKSUMS_URL="${FORGE}/dumber/releases/download/${VERSION}/checksums.txt"
108echo "Downloading checksums..."
109if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then
110    echo "Error: Failed to download checksums file"
111    exit 1
112fi
113
114echo "Downloading ${TARBALL}..."
115if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"; then
116    echo "Error: Failed to download ${TARBALL}"
117    exit 1
118fi
119
120# Verify checksum
121echo "Verifying checksum..."
122EXPECTED_CHECKSUM=$(grep -E "[[:space:]]${TARBALL}\$" "$TMP_DIR/checksums.txt" | awk '{print $1}')
123if [ -z "$EXPECTED_CHECKSUM" ]; then
124    echo "Error: Could not find checksum for ${TARBALL}"
125    exit 1
126fi
127
128if command -v sha256sum >/dev/null 2>&1; then
129    ACTUAL_CHECKSUM=$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')
130else
131    echo "Error: sha256sum not found"
132    exit 1
133fi
134
135if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
136    echo "Error: Checksum verification failed!"
137    echo "Expected: $EXPECTED_CHECKSUM"
138    echo "Actual:   $ACTUAL_CHECKSUM"
139    exit 1
140fi
141echo "Checksum verified."
142
143echo "Extracting..."
144tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"
145
146# Find the dumber binary (handles versioned subdirectory)
147BINARY=$(find "$TMP_DIR" -name "dumber" -type f -executable | head -1)
148if [ -z "$BINARY" ]; then
149    echo "Error: Could not find dumber binary in archive"
150    exit 1
151fi
152
153echo "Installing to ${INSTALL_DIR}..."
154if [ -w "$INSTALL_DIR" ]; then
155    mv "$BINARY" "$INSTALL_DIR/dumber"
156else
157    echo "sudo required to install to ${INSTALL_DIR}"
158    sudo mv "$BINARY" "$INSTALL_DIR/dumber"
159fi
160
161# Verify installation
162if command -v dumber >/dev/null 2>&1; then
163    echo ""
164    echo "Dumber installed successfully!"
165    dumber about
166else
167    echo ""
168    echo "Installation complete. Add ${INSTALL_DIR} to your PATH if needed."
169fi

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 8

Tags 42

↑↓ moveenter openesc close