binconfig(5)

NAME

.binconfig - Per-project configuration file for bin(1)

DESCRIPTION

A .binconfig file may be placed in the root directory of a project. It may contain any combination of global settings (which affect Bin CLI itself) and command settings (which affect a single command).

FILE FORMAT

A .binconfig file is written in INI format. The overall format is:

GLOBAL SETTINGS

[COMMAND NAME]
COMMAND SETTINGS

Each setting is written on a separate line in the format:

KEY = VALUE

Spaces are allowed around the = signs, and are automatically trimmed from the start/end of lines.

Values should not be quoted - quotes will be treated as part of the value. This avoids the need to escape inner quotes.

Boolean values can be set to true/false (recommended), yes/no, on/off or 1/0 (all case-insensitive). Anything else triggers an error.

Lines that start with ; or # are comments, which are ignored. No other lines can contain comments.

GLOBAL SETTINGS

Global settings may appear at the top of a file.

dir = DIRECTORY

Define a custom directory that contains the commands. The path is relative to the .binconfig file.

Default: bin

exact = true

Disable unique prefix matching.

Default: false

merge = true|optional

Merge the list of commands with a parent project.

If set to optional, no error will be raised if the parent project is missing. This may be useful in subprojects that have separate repositories, so you can't guarantee they will be cloned together.

Default: false

template = TEMPLATE

Customise the template for scripts created by --create. It is passed to echo -e, so you can use escape sequences such as \n for new lines.

Default: #!/usr/bin/env bash\nset -euo pipefail\n\n

COMMAND SETTINGS

alias = ALIAS
Define an alias for the command. The alias can be used in place of the command name to execute the command. This can be repeated multiple times to define multiple aliases.
aliases = ALIAS1, ALIAS2, ...
Define multiple aliases for the command at once.
command = DIRECTORY

Define the command to execute (instead of creating a script in the bin/ directory).

The command is executed within a Bash shell (bash -c "$command"), so it may contain logic operators (&&, ||), multiple commands separated by ;, and pretty much anything else that you can fit into a single line. Multi-line commands are not supported.

help = DIRECTORY
Add a short (one-line) description of the command. This will be displayed when you run bin with no parameters (or with an ambiguous prefix).

EXAMPLE CONFIG FILE

; Global settings
dir = scripts
exact = true
merge = true
template = #!/bin/sh\n\n

; Settings for each command (script)
[hello]
alias = hi
help = Say "Hello, World!"

[phpunit]
command = "$BIN_ROOT/vendor/bin/phpunit" "%@"

SEE ALSO