swadhin biswas feat(install): add standalone installer for pipe-to-bash convenience Β· 10/17/2025
d3d5885
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
#!/usr/bin/env bash
set -euo pipefail
# Standalone installer for ls-f
# Downloads both lsf and column.py, then installs them
REPO_URL="https://raw.githubusercontent.com/swadhinbiswas/ls-f/main"
INSTALL_MODE="${1:-user}"
echo "π ls-f Standalone Installer"
echo "Downloading lsf and column.py from GitHub..."
# Determine install directory
if [[ "$INSTALL_MODE" == "system" || "$EUID" -eq 0 ]]; then
BIN_DIR="/usr/local/bin"
echo "π Installing to: $BIN_DIR (system-wide)"
SUDO_CMD="sudo"
else
BIN_DIR="$HOME/.local/bin"
echo "π Installing to: $BIN_DIR (user-local)"
SUDO_CMD=""
fi
# Create directory
$SUDO_CMD mkdir -p "$BIN_DIR"
# Download files
echo "β¬οΈ Downloading lsf..."
$SUDO_CMD curl -fL "$REPO_URL/lsf" -o "$BIN_DIR/lsf"
echo "β¬οΈ Downloading column.py..."
$SUDO_CMD curl -fL "$REPO_URL/column.py" -o "$BIN_DIR/column.py"
# Make executable
echo "π§ Making files executable..."
$SUDO_CMD chmod +x "$BIN_DIR/lsf" "$BIN_DIR/column.py"
# Create config directory
echo "π Creating config directory..."
mkdir -p "$HOME/.config/lsf"
# Check PATH
if [[ "$INSTALL_MODE" != "system" && ":$PATH:" != *":$BIN_DIR:"* ]]; then
echo "β οΈ Warning: $BIN_DIR is not in your PATH"
echo " Add this to your shell config (~/.bashrc, ~/.zshrc, etc.):"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
# Verify installation
echo "β
Installation complete!"
echo ""
echo "π§ͺ Testing installation..."
if command -v "$BIN_DIR/lsf" >/dev/null 2>&1; then
echo "Version: $("$BIN_DIR/lsf" --version 2>/dev/null || echo "lsf installed")"
echo ""
echo "π Try it out:"
echo " lsf --help"
echo " lsf -x"
echo ""
echo "π‘ Optional: Set up alias:"
echo " echo \"alias ls='lsf'\" >> ~/.bashrc"
else
echo "β Installation verification failed"
exit 1
fi