detached b91a04a

fix(args): move --help check before any side effects

commit
b91a04a3eb9c229d384c4c07e2ff8b5a2d3ca6a8
author
bnema · · 2025-10-21 21:42 UTC
committer
bnema · · 2025-10-21 21:07 UTC
parent
090ebff
signature
unsigned
1 file · +21 -20
M install.sh +21 -20
@@ -4,26 +4,7 @@
44
55 set -eo pipefail
66
7-# Export global paths first (needed for re-exec)
8-export ARCHUP_PATH="${ARCHUP_PATH:-$HOME/.local/share/archup}"
9-export ARCHUP_INSTALL="$ARCHUP_PATH/install"
10-
11-# If stdin is not a TTY (piped from curl), save and re-exec with TTY
12-if [ ! -t 0 ]; then
13- # Save script to proper location
14- mkdir -p "$ARCHUP_PATH"
15- INSTALL_SCRIPT="$ARCHUP_PATH/install.sh"
16- cat > "$INSTALL_SCRIPT"
17- chmod +x "$INSTALL_SCRIPT"
18- # Re-exec with TTY connected
19- exec < /dev/tty "$INSTALL_SCRIPT" "$@"
20-fi
21-export ARCHUP_INSTALL_LOG_FILE="/var/log/archup-install.log"
22-export ARCHUP_INSTALL_CONFIG="/var/log/archup-install.conf"
23-export ARCHUP_REPO_URL="${ARCHUP_REPO_URL:-https://github.com/bnema/archup}"
24-export ARCHUP_RAW_URL="${ARCHUP_RAW_URL:-https://raw.githubusercontent.com/bnema/archup/main}"
25-
26-# Handle help flag early (doesn't need any files)
7+# Handle help flag FIRST - before any side effects
278 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
289 cat << 'HELP'
2910 Usage: install.sh [OPTIONS]
@@ -42,6 +23,26 @@ HELP
4223 exit 0
4324 fi
4425
26+# Export global paths (needed for re-exec)
27+export ARCHUP_PATH="${ARCHUP_PATH:-$HOME/.local/share/archup}"
28+export ARCHUP_INSTALL="$ARCHUP_PATH/install"
29+
30+# If stdin is not a TTY (piped from curl), save and re-exec with TTY
31+if [ ! -t 0 ]; then
32+ # Save script to proper location
33+ mkdir -p "$ARCHUP_PATH"
34+ INSTALL_SCRIPT="$ARCHUP_PATH/install.sh"
35+ cat > "$INSTALL_SCRIPT"
36+ chmod +x "$INSTALL_SCRIPT"
37+ # Re-exec with TTY connected
38+ exec < /dev/tty "$INSTALL_SCRIPT" "$@"
39+fi
40+
41+export ARCHUP_INSTALL_LOG_FILE="/var/log/archup-install.log"
42+export ARCHUP_INSTALL_CONFIG="/var/log/archup-install.conf"
43+export ARCHUP_REPO_URL="${ARCHUP_REPO_URL:-https://github.com/bnema/archup}"
44+export ARCHUP_RAW_URL="${ARCHUP_RAW_URL:-https://raw.githubusercontent.com/bnema/archup/main}"
45+
4546 # Bootstrap FIRST: Install gum and jq (required for download script)
4647 if [ ! -d "$ARCHUP_INSTALL" ]; then
4748 # First time running from curl, need to download bootstrap
@@ -4,26 +4,7 @@
4 4
5 set -eo pipefail5 set -eo pipefail
6 6
7-# Export global paths first (needed for re-exec)7+# Handle help flag FIRST - before any side effects
8-export ARCHUP_PATH="${ARCHUP_PATH:-$HOME/.local/share/archup}"
9-export ARCHUP_INSTALL="$ARCHUP_PATH/install"
10-
11-# If stdin is not a TTY (piped from curl), save and re-exec with TTY
12-if [ ! -t 0 ]; then
13- # Save script to proper location
14- mkdir -p "$ARCHUP_PATH"
15- INSTALL_SCRIPT="$ARCHUP_PATH/install.sh"
16- cat > "$INSTALL_SCRIPT"
17- chmod +x "$INSTALL_SCRIPT"
18- # Re-exec with TTY connected
19- exec < /dev/tty "$INSTALL_SCRIPT" "$@"
20-fi
21-export ARCHUP_INSTALL_LOG_FILE="/var/log/archup-install.log"
22-export ARCHUP_INSTALL_CONFIG="/var/log/archup-install.conf"
23-export ARCHUP_REPO_URL="${ARCHUP_REPO_URL:-https://github.com/bnema/archup}"
24-export ARCHUP_RAW_URL="${ARCHUP_RAW_URL:-https://raw.githubusercontent.com/bnema/archup/main}"
25-
26-# Handle help flag early (doesn't need any files)
27 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then8 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
28 cat << 'HELP'9 cat << 'HELP'
29 Usage: install.sh [OPTIONS]10 Usage: install.sh [OPTIONS]
@@ -42,6 +23,26 @@ HELP
42 exit 023 exit 0
43 fi24 fi
44 25
26+# Export global paths (needed for re-exec)
27+export ARCHUP_PATH="${ARCHUP_PATH:-$HOME/.local/share/archup}"
28+export ARCHUP_INSTALL="$ARCHUP_PATH/install"
29+
30+# If stdin is not a TTY (piped from curl), save and re-exec with TTY
31+if [ ! -t 0 ]; then
32+ # Save script to proper location
33+ mkdir -p "$ARCHUP_PATH"
34+ INSTALL_SCRIPT="$ARCHUP_PATH/install.sh"
35+ cat > "$INSTALL_SCRIPT"
36+ chmod +x "$INSTALL_SCRIPT"
37+ # Re-exec with TTY connected
38+ exec < /dev/tty "$INSTALL_SCRIPT" "$@"
39+fi
40+
41+export ARCHUP_INSTALL_LOG_FILE="/var/log/archup-install.log"
42+export ARCHUP_INSTALL_CONFIG="/var/log/archup-install.conf"
43+export ARCHUP_REPO_URL="${ARCHUP_REPO_URL:-https://github.com/bnema/archup}"
44+export ARCHUP_RAW_URL="${ARCHUP_RAW_URL:-https://raw.githubusercontent.com/bnema/archup/main}"
45+
45 # Bootstrap FIRST: Install gum and jq (required for download script)46 # Bootstrap FIRST: Install gum and jq (required for download script)
46 if [ ! -d "$ARCHUP_INSTALL" ]; then47 if [ ! -d "$ARCHUP_INSTALL" ]; then
47 # First time running from curl, need to download bootstrap48 # First time running from curl, need to download bootstrap

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 1

Tags 0

    ↑↓ moveenter openesc close