GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — code/scripts/install-codedb-w.sh at main · nikivdev/code

Expand file tree

/

install-codedb-w.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
100 lines (81 loc) · 2.52 KB
/

install-codedb-w.sh

Copy path

File metadata and controls

100 lines (81 loc) · 2.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${ROOT_DIR}"
CODEDB_DIR="${CODEDB_DIR:-$HOME/bin}"
FLOW_CODEDB_ALIAS_DIR="${FLOW_CODEDB_ALIAS_DIR:-$HOME/bin}"
CODEDB_INSTALL_SCRIPT="${CODEDB_INSTALL_SCRIPT:-$HOME/repos/justrach/codedb/install/install.sh}"
CODEDB_INSTALL_URL="${CODEDB_INSTALL_URL:-https://codedb.codegraff.com/install.sh}"
resolve_codedb_bin() {
if [[ -n "${CODEDB_BIN:-}" && -x "${CODEDB_BIN}" ]]; then
printf '%s\n' "${CODEDB_BIN}"
return 0
fi
local candidate=""
for candidate in \
"${CODEDB_DIR}/codedb" \
"$HOME/bin/codedb" \
"$HOME/.local/bin/codedb" \
"$(command -v codedb 2>/dev/null || true)"
do
if [[ -n "${candidate}" && -x "${candidate}" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
done
return 1
}
install_codedb() {
if [[ -x "${CODEDB_INSTALL_SCRIPT}" ]]; then
CODEDB_DIR="${CODEDB_DIR}" bash "${CODEDB_INSTALL_SCRIPT}"
return 0
fi
curl -fsSL "${CODEDB_INSTALL_URL}" | CODEDB_DIR="${CODEDB_DIR}" sh
}
write_wrapper() {
local wrapper_dir="${FLOW_CODEDB_ALIAS_DIR}"
local wrapper="${wrapper_dir}/w"
local tmp
mkdir -p "${wrapper_dir}"
tmp="$(mktemp "${TMPDIR:-/tmp}/flow-codedb-w.XXXXXX")"
{
echo '#!/usr/bin/env bash'
echo 'set -euo pipefail'
printf 'CODEDB_RESOLVED=%q\n' "${CODEDB_BIN_RESOLVED}"
cat <<'EOF'
if [[ -n "${CODEDB_BIN:-}" && -x "${CODEDB_BIN}" ]]; then
exec "${CODEDB_BIN}" "$@"
fi
if [[ -n "${CODEDB_RESOLVED:-}" && -x "${CODEDB_RESOLVED}" ]]; then
exec "${CODEDB_RESOLVED}" "$@"
fi
CODEDB_DIR="${CODEDB_DIR:-$HOME/bin}"
for candidate in \
"${CODEDB_DIR}/codedb" \
"$HOME/bin/codedb" \
"$HOME/.local/bin/codedb" \
"$(command -v codedb 2>/dev/null || true)"
do
if [[ -n "${candidate}" && -x "${candidate}" ]]; then
exec "${candidate}" "$@"
fi
done
echo "w: codedb not found. Re-run: f install-codedb-w" >&2
exit 127
EOF
} > "${tmp}"
install -m 755 "${tmp}" "${wrapper}"
rm -f "${tmp}"
printf 'codedb -> %s\n' "${CODEDB_BIN_RESOLVED}"
printf 'wrapper -> %s\n' "${wrapper}"
printf 'note -> shadows /usr/bin/w when %s is earlier on PATH\n' "${wrapper_dir}"
printf 'which w -> %s\n' "$(command -v w)"
}
main() {
if ! CODEDB_BIN_RESOLVED="$(resolve_codedb_bin)"; then
install_codedb
CODEDB_BIN_RESOLVED="$(resolve_codedb_bin)"
fi
write_wrapper
}
main "$@"
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.