- Download binary for platform from Releases
- Add init command to your shell init: ie for zsh add to ~/.zshrc
eval "$(tome init my-commands ~/my-scripts zsh)"
my-commands --help
Tome provides easy organization and execution of collections of command line scripts.
With a directory of scripts like this:
root/
go-to-workspace
android/
debug
python/
start-virtualenv
work/
start-my-server
my-team/
provision-my-service
Tome allows for executing them like:
$ my-command go-to-workspace
$ my-command android debug
$ my-command work start-my-server
$ my-command work my-team provision-my-service
# print a list of all commands and usage
$ my-command
And add in some features for discoverability:
- tab-completion
- search all available commands (just enter your command with no arguments)
- help commands
Everyone has their own way of sharing scripts with each other. In my experience it usually comes down to a git repo and prepending things to the path.
This works well for a small group, but once you're trying to share scripts across a larger organization, issues arise:
- discoverability: how do I see what already exists?
- namespacing: how do I find commands that relate to what I'm working on?
- completion: It's nice
https://github.com/basecamp/sub
Tome is provided as self-encapsulated, broadly compatible binaries. Choose the latest binary that's appropriate for your OS at the Github releases page.
Download it into a well known, persistent location. A recommendedation is in your home directory, such as $HOME/bin/tome
Create a nested hierarchy of shell (or whatever) scripts:
root/
go-to-workspace
android/
debug
work/
start-my-server
my-team/
provision-my-service
(keeping these in version control is recommended)
Put them in a well known, persistent location as well (e.g. ~/my-scripts).
If you want your top-level command to be named "my-commands" you'd put the following in your .bashrc or .zshrc:
# posix example, e.g. .bashrc
eval "$(tome init my-commands ~/my-scripts bash)"
# zsh
eval "$(tome init my-commands ~/my-scripts zsh)"
For fish shell:
# in ~/.config/fish/conf.d/tome.fish
tome init my-commands ~/my_script_dir $0 | source
NOTE: make sure to include the double quotes with the nested backticks. This ensures that newlines are captured and evaluated appropriately.
Once installed, start a new shell and you should have your new command!
See CONTRIBUTING.md