bin - A simple task/script runner for any language
bin [OPTIONS] [--] [COMMAND] [ARGUMENTS...]
Bin CLI is a simple task runner, designed to be used in code repositories, with scripts written in any programming language.
It automatically searches in parent directories, so you can run scripts from anywhere in the project tree. It also supports aliases, unique prefix matching and tab completion, reducing the amount you need to type.
Options that can be used with a command:
- --dir DIR, --dir=DIR
- Specify the directory name to search for (overrides .binconfig).
- --exact
- Disable unique prefix matching.
- --exe NAME, --exe=NAME
- Override the executable name displayed in the command list.
- --fallback COMMAND, --fallback=COMMAND
- If the command is not found, run the given global command (implies --exact).
- --prefix
- Enable unique prefix matching (overrides .binconfig).
- --shim
- If the command is not found, run the global command with the same name (implies --exact).
Options that do something with a COMMAND:
- --create, -c
- Create the given script and open in your $EDITOR (implies --exact).
- --edit, -e
- Open the given script in your $EDITOR.
Options that do something special and don't accept a COMMAND:
- --completion
- Output a tab completion script for the current shell.
- --info
- Display information about the current project (root, bin directory and config file location).
- --help, -h
- Display the help text.
- --version, -v
- Display the current version number.
Any options must be given before the command, because everything after the command will be passed as parameters to the script.
All of these examples are dependent on the scripts that exist in <root>/bin, as well as the contents of the .binconfig file (if any).
Your preferred editor is determined by $VISUAL
or $EDITOR
. (If neither are set, it defaults to editor, nano or vi.)
The environment variables $BIN_EXE
('bin' executable name) and $BIN_COMMAND
(executable name + command name) are passed to all commands executed by Bin CLI. For maximum portability, use ${BIN_COMMAND-$0}
.
The environment variables $BIN_ROOT
(root directory path) and $BIN_DIR
(bin/ directory path) are passed to inline commands (defined in .binconfig) only.
The exit status of a command is preserved. Exit statuses that may be set by bin itself are:
Bin CLI executes arbitrary commands/scripts in the current working directory (or the directory specified by --dir) - the same as if you executed them directly. You should not run commands from untrusted sources.
https://github.com/bin-cli/bin-cli/issues
Copyright © 2023-2024 Dave James Miller.
This is free software released under the MIT License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.