preamble
Formats files with a preamble, with the preamble looked up based on path.
This is useful for things such as copyright headers or shebang lines.
Pants substitutes the following identifiers (following Python's string.Template substitutions): - $year: The current year (only used when actually writing the year to the file).
Backend: pants.backend.tools.preamble
Config section: [preamble]
Basic options
False
If true, don't use preamble when running pants fmt
.
template_by_globs
template_by_globs
--preamble-template-by-globs="{'key1': val1, 'key2': val2, ...}"
PANTS_PREAMBLE_TEMPLATE_BY_GLOBS
{}
Which preamble template to use based on the path globs (relative to the build root).
Example:
{
'*.rs': '// Copyright (c) $year\n// Line 2\n'
'*.py:!__init__.py': '# Copyright (c) $year\n# Line 2\n',
}
It might be helpful to load this config from a JSON or YAML file. To do that, set [preamble].config = '@path/to/config.yaml'
, for example.
Advanced options
None
Deprecated options
None
Updated about 2 months ago