This commit is contained in:
schmeeve
2026-09-26 22:06:28 -07:00
parent bc365267d0
commit 0758095046
14 changed files with 1392 additions and 0 deletions

37
cli/install.sh Normal file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# snotes CLI installer — rendered by the server for user "__SNOTES_USER__".
# Usage: curl -fsSL __SNOTES_URL__/__SNOTES_USER__/cli | bash
set -euo pipefail
SNOTES_URL="__SNOTES_URL__"
SNOTES_USER="__SNOTES_USER__"
BIN_DIR="$HOME/.local/bin"
CFG_DIR="$HOME/.config/snotes"
if ! command -v uv >/dev/null 2>&1; then
echo "snotes needs 'uv' to run (https://docs.astral.sh/uv/)." >&2
echo "Install it first: curl -LsSf https://astral.sh/uv/install.sh | sh" >&2
exit 1
fi
mkdir -p "$BIN_DIR" "$CFG_DIR"
echo "Downloading snotes CLI from $SNOTES_URL ..."
curl -fsSL "$SNOTES_URL/cli/snotes.py" -o "$BIN_DIR/snotes"
chmod +x "$BIN_DIR/snotes"
umask 077
cat > "$CFG_DIR/config.json" <<EOF
{
"url": "$SNOTES_URL",
"user": "$SNOTES_USER"
}
EOF
echo "✓ installed to $BIN_DIR/snotes"
echo "✓ config written to $CFG_DIR/config.json (user: $SNOTES_USER)"
case ":$PATH:" in
*":$BIN_DIR:"*) ;;
*) echo "note: $BIN_DIR is not on your PATH — add it, or run: $BIN_DIR/snotes" ;;
esac
echo "Try it: snotes --help"