init commit

This commit is contained in:
Yehoshua Adam Sandler
2026-02-05 15:33:07 -06:00
commit e70b629b4a
13 changed files with 1021 additions and 0 deletions

57
install.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -euo pipefail
INSTALL_DIR="/usr/local/bin"
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/mach"
BINARY="build/mach"
OS="$(uname -s)"
echo "Installing mach..."
# Build if binary not present
if [ ! -f "$BINARY" ]; then
echo "Building..."
make build
fi
# Install binary
echo "Copying binary to $INSTALL_DIR..."
sudo cp "$BINARY" "$INSTALL_DIR/mach"
sudo chmod +x "$INSTALL_DIR/mach"
# Check PATH
if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then
echo "WARNING: $INSTALL_DIR is not in your PATH. Add it to your shell profile."
fi
# Create config with defaults if not present
if [ ! -f "$CONFIG_DIR/config.json" ]; then
mkdir -p "$CONFIG_DIR"
cat > "$CONFIG_DIR/config.json" <<'EOF'
{
"input_type": "md",
"output_type": "rtf"
}
EOF
echo "Created default config at $CONFIG_DIR/config.json"
fi
# Linux: create .desktop entry
if [ "$OS" = "Linux" ]; then
DESKTOP_DIR="$HOME/.local/share/applications"
mkdir -p "$DESKTOP_DIR"
cat > "$DESKTOP_DIR/mach.desktop" <<EOF
[Desktop Entry]
Name=mach
Comment=Markdown to RTF clipboard converter
Exec=$INSTALL_DIR/mach %f
Terminal=true
Type=Application
Categories=Utility;TextTools;
MimeType=text/markdown;
EOF
echo "Created desktop entry at $DESKTOP_DIR/mach.desktop"
fi
echo "Done! Run 'mach -v' to verify."