Faxmachine is a powerful utility for storing, organizing, and injecting commonly used files and templates across your projects.
- Simple Command Line Interface: Easy to use commands for managing your file templates
- Interactive Browser: Navigate your template collection with a user-friendly interface
- Smart Search: Find templates by filename, contents, tags, or description
- File Preview: See what you're getting before injecting files
- Metadata Support: Add descriptions and tags to better organize your templates
- Category Organization: Keep templates neatly arranged in categories and subcategories
- Built-in Templates: Comes with pre-built templates for React, Python, Vue, Next.js, and FastAPI
- Clone this repository:
git clone https://github.com/yourusername/faxmachine.git
- Add the
src
directory to your PATH, or create a symlink tofaxmachine.sh
in a directory that's already in your PATH:
ln -s /path/to/faxmachine/src/faxmachine.sh /usr/local/bin/faxmachine
# Optional: Create shorter alias
ln -s /path/to/faxmachine/src/faxmachine.sh /usr/local/bin/fm
- Make sure both scripts are executable:
chmod +x /path/to/faxmachine/src/faxmachine.sh
chmod +x /path/to/faxmachine/src/faxmachine.py
- Initialize the database:
faxmachine init
- (Optional) Add built-in templates to your faxmachine database:
./add_templates_to_faxmachine.sh
- Python 3.6 or higher
- Bash shell
The easiest way to use Faxmachine is in interactive mode, which you can access by running faxmachine
or fm
with no arguments:
faxmachine
# or
fm
# Browse files with interactive browser
faxmachine browse
# Add a file to the database
faxmachine add path/to/your/file.txt
# Add a file with metadata
faxmachine add config.json --category config --description "My config template" --tags "json,config,template"
# Search for templates
faxmachine search gitignore
# Search in file contents as well
faxmachine search "import os" --content-search
# List all available templates
faxmachine list
# Inject a template into your current directory
faxmachine inject git/gitignore
# Show template contents
faxmachine show git/gitignore
# Show recently used templates
faxmachine recent
# Delete a template
faxmachine delete git/gitignore
Faxmachine stores your templates in ~/.faxmachine/db/
organized in categories. Metadata is stored in ~/.faxmachine/metadata/
.
Faxmachine comes with pre-built templates for various frameworks and languages:
- React: Component and custom hook templates
- Python: SQLAlchemy models and Flask routes
- FastAPI: Router templates
- Vue: Component templates
- Next.js: Page templates
To use these templates:
- Add them to your faxmachine database:
./add_templates_to_faxmachine.sh
- Browse and use them:
faxmachine search react
faxmachine inject react/Component.tsx
For more information about the built-in templates, see the templates/README.md.
Tags can be added to templates for better organization and easier searching:
faxmachine add myfile.txt --tags "important,example,reference"
You can then search by tags:
faxmachine search reference --tags "important"
Before injecting a file, Faxmachine can show a preview, including a diff if you're overwriting an existing file:
faxmachine inject config/package.json
Faxmachine configuration is stored in ~/.faxmachine/config.json
. You can edit this file to customize behavior.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.