-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·91 lines (70 loc) · 1.96 KB
/
install
File metadata and controls
executable file
·91 lines (70 loc) · 1.96 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
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
#!/usr/bin/env bash
set -euo pipefail
# nvimv installer script
# Downloads and installs nvimv to ~/.local/bin/ (configurable)
# Configuration
INSTALL_DIR="${NVIMV_INSTALL_DIR:-${PREFIX:-$HOME/.local}/bin}"
REPO_URL="https://raw.githubusercontent.com/jrop/nvimv/main/nvimv"
check_dependencies() {
local missing_deps=()
if ! command -v curl >/dev/null 2>&1; then
missing_deps+=("curl")
fi
if ! command -v jq >/dev/null 2>&1; then
missing_deps+=("jq")
fi
if [ ${#missing_deps[@]} -ne 0 ]; then
echo "Missing required dependencies: ${missing_deps[*]}"
echo "Please install them and try again."
exit 1
fi
}
main() {
echo "Installing nvimv..."
# Check dependencies
check_dependencies
if [ ! -d "$INSTALL_DIR" ]; then
echo "Creating install directory: $INSTALL_DIR"
mkdir -p "$INSTALL_DIR"
fi
# Download nvimv
echo "Downloading nvimv from $REPO_URL"
if curl -fsSL "$REPO_URL" -o "$INSTALL_DIR/nvimv"; then
echo "Downloaded nvimv to $INSTALL_DIR/nvimv"
else
echo "Failed to download nvimv"
exit 1
fi
# Make executable
chmod +x "$INSTALL_DIR/nvimv"
echo "Made nvimv executable"
# Check if install directory is in PATH
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "Install directory $INSTALL_DIR is not in your PATH"
echo "Add this to your shell profile (.bashrc, .zshrc, etc.):"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
fi
echo "✅ nvimv installed successfully!"
echo "Run 'nvimv --help' to get started"
}
# Show help
if [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]]; then
cat <<EOF
nvimv installer
Usage: $0 [options]
Options:
-h, --help Show this help message
Environment variables:
NVIMV_INSTALL_DIR Installation directory (default: ~/.local/bin)
PREFIX Alternative prefix (default: ~/.local)
Examples:
# Install to default location
$0
# Install to custom directory
NVIMV_INSTALL_DIR=/usr/local/bin $0
# Install with custom prefix
PREFIX=/opt/local $0
EOF
exit 0
fi
main "$@"