This guide helps users migrate from the original tome or sub to tome-cli.
- Why Migrate?
- What's Different
- What's the Same
- Migration Checklist
- Breaking Changes
- New Features
- Troubleshooting Migration
tome-cli is a complete rewrite with several improvements:
- Better completions: Smarter tab completion with description support
- Improved help: Automatic help text extraction from scripts
- Faster: More efficient script discovery and execution
- Better tested: Comprehensive test suite with E2E tests
- Active development: Maintained with new features and bug fixes
- Enhanced features: Script-level completions, better ignore patterns, environment injection
Original tome:
# Installed via pip
pip install tome
# Or via shell script
curl -L https://github.com/toumorokoshi/tome/raw/master/install.sh | bashtome-cli:
# Download from releases
# https://github.com/zph/tome-cli/releases
# Or build from source
go build -o tome-cliOriginal tome:
- Binary name:
tome
tome-cli:
- Binary name:
tome-cli(but you can create aliases with any name)
Original tome:
tome script-name argstome-cli:
# Direct execution
tome-cli --root ~/scripts exec script-name args
# Or with alias (recommended)
tome-cli --root ~/scripts --executable tome alias --output ~/bin/tome
tome script-name argsBoth support similar formats, but tome-cli is more flexible:
Original tome:
- Used
# summary: description - Help text parsing varied
tome-cli:
- Supports both
USAGE:andSUMMARY:(for backward compatibility) - More consistent parsing
- Better multi-line help support
Directory structure works the same way:
scripts/
├── folder/
│ ├── subscript1
│ └── subscript2
└── top-level-script
Commands: tome folder subscript1, tome top-level-script
Scripts still need to be:
- Executable (
chmod +x) - Have a shebang (
#!/usr/bin/env bash, etc.) - Any language works
Both inject similar environment variables:
| Original tome | tome-cli | Description |
|---|---|---|
TOME_ROOT |
TOME_ROOT |
Scripts directory |
| N/A | TOME_EXECUTABLE |
CLI command name |
{NAME}_ROOT |
{NAME}_ROOT |
Uppercase alias + _ROOT |
| N/A | {NAME}_EXECUTABLE |
Uppercase alias + _EXECUTABLE |
Download from releases or build from source:
# Download latest release
# https://github.com/zph/tome-cli/releases
# Make it executable
chmod +x tome-cli
# Move to your PATH
mv tome-cli ~/bin/ # or /usr/local/bin/Create a tome alias to maintain compatibility:
# Replace original tome with tome-cli
tome-cli --root ~/your-scripts --executable tome alias --output ~/bin/tome
chmod +x ~/bin/tomeNow tome commands work as before!
Update your scripts to use USAGE: format:
Before (original tome):
#!/usr/bin/env bash
# summary: Deploy the applicationAfter (tome-cli - both work):
#!/usr/bin/env bash
# USAGE: deploy <environment>
# Deploy the application to the specified environment
#
# This supports multi-line help text until the first blank line.Or keep using SUMMARY: - it still works:
#!/usr/bin/env bash
# SUMMARY: deploy <environment>
# Deploy the applicationOriginal tome:
- Used
.tomercfile
tome-cli:
- Uses
.tomeignorefile (gitignore syntax)
Migrate your ignore patterns:
# .tomerc (original tome)
[ignore]
patterns = *.pyc, __pycache__, test_*
# .tomeignore (tome-cli)
*.pyc
__pycache__/
test_*Original tome:
# In ~/.bashrc
source ~/tome/completion/bash/tome.bashtome-cli:
# In ~/.bashrc
eval "$(tome completion bash)"
# Or with your custom alias
eval "$(~/bin/tome completion bash)"Run your existing scripts with tome-cli:
# List all commands (verify everything is detected)
tome help
# Test a specific script
tome your-script-name
# Check completions work
tome <TAB><TAB>Update any references to tome installation and usage in:
- CI/CD pipelines
- Documentation
- Setup scripts
- Team onboarding guides
Impact: Scripts or tools that call tome directly will need updating.
Solution:
# Create an alias with the original name
tome-cli --root ~/scripts --executable tome alias --output ~/bin/tomeImpact: .tomerc is not used; .tomeignore is used instead.
Solution: Convert your .tomerc patterns to .tomeignore (gitignore syntax).
Impact: Direct usage requires exec subcommand.
Solution:
# Instead of: tome script-name
tome-cli --root ~/scripts exec script-name
# Or create an alias to avoid this
tome-cli --root ~/scripts --executable tome alias --output ~/bin/tome
# Now: tome script-name worksImpact: Original tome used .tomerc for configuration.
Solution: tome-cli uses CLI flags or environment variables:
# Use environment variables
export TOME_ROOT=~/scripts
tome-cli exec script-name
# Or create an alias with embedded config
tome-cli --root ~/scripts --executable tome alias --output ~/bin/tometome-cli adds features not available in original tome:
Your scripts can provide their own tab completions:
#!/usr/bin/env bash
# TOME_COMPLETION
# USAGE: my-script <command>
case "${1:-}" in
--complete)
echo -e "start\tStart the service"
echo -e "stop\tStop the service"
exit 0
;;
*)
# Normal script logic
;;
esacSee completion-guide.md for details.
tome-cli injects more environment variables:
#!/usr/bin/env bash
# Access the CLI executable name
echo "Run: $TOME_EXECUTABLE help for more info"
# Access the root directory
source "$TOME_ROOT/lib/common.sh"Multi-line help text with better formatting:
#!/usr/bin/env bash
# USAGE: my-script <arg1> [arg2]
# This is a detailed description
# that spans multiple lines.
#
# Examples:
# my-script value1
# my-script value1 value2Create multiple custom CLIs from the same scripts:
# Create different aliases for different teams
tome-cli --root ~/scripts --executable team-a alias --output ~/bin/team-a
tome-cli --root ~/scripts --executable team-b alias --output ~/bin/team-bGitignore-like syntax with more flexibility:
# .tomeignore
*.bak
*.tmp
test_*/
lib/*.sh # Ignore library files
Symptom: tome script-name says script not found.
Possible causes:
- Script not executable:
chmod +x script-name - Script being ignored: Check
.tomeignore - Wrong root directory: Verify
$TOME_ROOTor alias configuration
Solution:
# Check what scripts are detected
tome help
# Use debug mode to see what's happening
tome-cli --debug --root ~/scripts exec script-nameSymptom: Tab completion doesn't show your scripts.
Possible causes:
- Completions not installed
- Using wrong completion command
- Shell not reloaded
Solution:
# Reinstall completions with your alias name
eval "$(tome completion bash)"
# Reload shell
source ~/.bashrc
# Or start a new shell session
exec bashSymptom: tome help script-name shows nothing.
Possible causes:
- No
USAGE:orSUMMARY:in script - Help text format incorrect
- Blank line after shebang missing
Solution:
#!/usr/bin/env bash
# USAGE: script-name
# Description here
#
# (blank line ends help text)
# Rest of scriptSymptom: Scripts behave differently under tome-cli.
Possible causes:
- Different environment variables
- Different execution context
- Different PATH or environment
Debug approach:
# Add debugging to your script
#!/usr/bin/env bash
# USAGE: debug-script
echo "TOME_ROOT: $TOME_ROOT"
echo "TOME_EXECUTABLE: $TOME_EXECUTABLE"
echo "PATH: $PATH"
env | grep TOMESymptom: tome-cli slower than original tome.
Unlikely but possible solutions:
- Check for large
.tomeignorepatterns - Verify scripts directory isn't huge
- Use
--debugto see where time is spent
time tome-cli --debug --root ~/scripts exec script-nameIf you encounter issues during migration:
-
Check the documentation:
- README.md - General usage
- writing-scripts.md - Script writing guide
- completion-guide.md - Completion implementation
-
Enable debug mode:
tome-cli --debug --root ~/scripts exec script-name
-
Compare with examples:
- Look at examples/ directory
- Test with the example scripts first
-
Report issues:
- Open an issue on GitHub with details:
- Original tome version
- tome-cli version
- Script that's not working
- Error messages and debug output
- Open an issue on GitHub with details:
After migration, you'll have:
- ✅ Better tab completions with descriptions
- ✅ Consistent help text formatting
- ✅ Script-level completions
- ✅ More reliable execution
- ✅ Better debugging tools
- ✅ Active maintenance and updates
- ✅ Backward compatibility with existing scripts
Most migrations are straightforward - create an alias and update completions. Your scripts should work as-is!