Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
58 lines (47 loc) · 1.53 KB
/
Copy pathinstall.sh
File metadata and controls
58 lines (47 loc) · 1.53 KB
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
#!/usr/bin/env bash
# pdf2md installer
# Usage: curl -fsSL https://raw.githubusercontent.com/jschof1/pdf2md/main/install.sh | bash
set -euo pipefail
BOLD='\033[1m'
GREEN='\033[0;32m'
DIM='\033[2m'
RESET='\033[0m'
INSTALL_DIR="${1:-/usr/local/bin}"
REMOTE_URL="https://raw.githubusercontent.com/jschof1/pdf2md/main/pdf2md"
echo -e "${BOLD}pdf2md installer${RESET}"
echo ""
# Check for curl
if ! command -v curl &>/dev/null; then
echo "Error: curl is required but not found." >&2
exit 1
fi
# Pick install location
if [[ ! -w "$INSTALL_DIR" ]] && [[ "$EUID" -ne 0 ]]; then
echo -e "${DIM}${INSTALL_DIR} not writable, trying ~/.local/bin...${RESET}"
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
DEST="$INSTALL_DIR/pdf2md"
echo -e "${DIM}Downloading pdf2md...${RESET}"
curl -fsSL "$REMOTE_URL" -o "$DEST"
chmod +x "$DEST"
echo ""
echo -e "${GREEN}✓${RESET} Installed to ${BOLD}${DEST}${RESET}"
echo ""
# Check if on PATH
if ! command -v pdf2md &>/dev/null; then
echo -e "${DIM}pdf2md is not on your PATH. Add this to your shell profile:${RESET}"
echo ""
echo -e " ${BOLD}export PATH=\"${INSTALL_DIR}:\$PATH\"${RESET}"
echo ""
fi
# Check for API key
if [[ -z "${GEMINI_API_KEY:-}" ]]; then
echo -e "${DIM}Next step: set your Gemini API key (free)${RESET}"
echo ""
echo -e " ${BOLD}export GEMINI_API_KEY=\"your-key-here\"${RESET}"
echo ""
echo -e " Get a key at ${DIM}https://aistudio.google.com/apikey${RESET}"
echo ""
fi
echo -e "Run ${BOLD}pdf2md --help${RESET} to get started."