alias |
---|
metool |
MeTool (mt
) is a lightweight, modular system designed to capture, organize,
and evolve my shell environment. Like a gardener's propagation tray for
seedlings, it provides the perfect environment where scripts, functions, and
tools can take root and grow before being transplanted into standalone
projects.
- Instant Access: Jump to any function's source with
mt cd
or edit withmt edit
- Self-bootstrapping & Modular: Built as a module itself, making it easy to understand and extend
- Environment Separation: Maintain distinct personal, public, and work modules
- Unix Philosophy: Leverages symlinks and simple directory structures for maximum flexibility
cd
- Change to mt root or specified targetcomponents
- List all package components (bin, shell, config, etc.)deps
- Check metool dependencies (--install to auto-install on macOS)disable
- Disable systemd service(s) while preserving service filesedit
- Edit function, executable or fileenable
- Enable systemd service(s) from a packagegit
- Git repository management commands:clone
- Clone a git repository to a canonical location (or show status if already cloned)repos
- List git repositoriessync
- Sync repositories from repos.txt manifest filetrusted
- Check if repository is trusted or list patterns
install
- Symlink package directories: bin, config, shellmodules
- List all metool modules (collections of packages)packages
- List all metool packages with their parent modulesreload
- Reload metoolupdate
- Update metool from git
Use -h
or --help
for command usage.
- Capture Ideas Fast: Turn quick shell hacks into organized, reusable tools
- Share Selectively: Keep private scripts private, share what's useful
- Evolve Naturally: Start simple, refactor safely, extract when ready
- Stay Organized: Never lose track of where that useful function lives
MeTool brings structure to shell creativity while keeping everything accessible and hackable.
Metool requires the following tools:
- GNU coreutils (for
realpath
)- macOS:
brew install coreutils
- Ubuntu/Debian: Usually pre-installed
- macOS:
- GNU Stow 2.4.0+ (for
mt install
)- macOS:
brew install stow
- Ubuntu/Debian:
apt install stow
(ensure version 2.4.0 or later) - Required: Version 2.4.0 or later for proper
dot-
directory support
- macOS:
- bash-completion (optional, for alias completion support)
- macOS:
brew install bash-completion@2
- Ubuntu/Debian:
apt install bash-completion
- macOS:
- GNU ln (optional, for relative symlinks)
- macOS: Included with coreutils
- Ubuntu/Debian: Pre-installed
- bats-core (optional, for running tests)
- macOS:
brew install bats-core
- Ubuntu/Debian:
npm install -g bats
orapt install bats
- macOS:
Use mt deps
to check if all dependencies are installed:
# Check dependencies
mt deps
# On macOS with Homebrew, offer to install missing dependencies
mt deps --install
Note: mt install
automatically checks for required dependencies before installing metool.
curl -sSL https://raw.githubusercontent.com/mbailey/metool/master/install.sh | bash
This will:
- Bootstrap metool using metool itself
- Clone metool to its canonical location (
~/Code/github.com/mbailey/metool
by default) - Install required dependencies (with your permission)
- Configure your shell (.bashrc or .zshrc)
- Provide next steps
-
Clone and install MeTool:
git clone https://github.com/mbailey/metool.git cd metool ./install.sh
-
Reload your shell:
source ~/.bashrc # or ~/.zshrc for zsh users
-
Verify installation:
mt --help # if using bash mtbin --help # works in any shell
mt clone https://github.com/mbailey/metool-packages.git
mt install metool-packages/*
If you use zsh (default on modern macOS), use the mtbin
command instead of mt
:
mtbin install package-name
mtbin deps --install # Check and install dependencies
A Metool Module is a collection of Metool Packages.
A typical metool module with packages might look like this:
~/mt-public/ # A metool module directory
├── neovim/ # A metool package
│ ├── bin/ # (Optional) Executable scripts
│ │ ├── nvim-config-check
│ │ └── nvim-update-plugins
│ ├── config/ # (Optional) Configuration files
│ │ └── dot-config/ # Maps to ~/.config/
│ │ └── nvim/ # Maps to ~/.config/nvim/
│ │ ├── init.lua
│ │ └── lua/
│ ├── docs/ # (Optional) Documentation
│ │ └── keybindings.md
│ ├── lib/ # (Optional) Library files used by bin scripts
│ │ └── nvim-helpers.sh
│ ├── README.md # Package documentation
│ └── shell/ # (Optional) Files to be sourced
│ ├── aliases # Shell aliases
│ ├── env # Environment variables
│ └── functions # Shell functions
└── tmux/ # Another metool package
├── bin/
├── config/
└── README.md
When you run mt install ~/public/neovim
, metool will:
- Create symlinks from the package's bin/ directory to ~/.metool/bin/
- Create symlinks from config/ to their respective locations (e.g., dot-config/ to ~/.config/)
- Create symlinks from shell/ to ~/.metool/shell/
A metool module can contain multiple packages, and you can selectively install packages from different modules.
Since mt
is implemented as a shell function (to enable environment modifications), it cannot be called directly from scripts. For script usage, metool provides the mtbin
wrapper:
#!/bin/bash
# Example: Installing packages from a script
# Use mtbin instead of mt for script usage
mtbin install dev/git-tools
mtbin install personal/shell-utils
# All mt commands work through mtbin
mtbin list
mtbin sync dev
The mtbin
script is installed in metool's bin/
directory and sources the metool function before executing commands.