cutter is Cutter's command line, which you run on your computer or in your CI. cutter lint checks .config/cutter.yml, the settings file Cutter's workflows read, and each changelog it lists, by the rules those workflows apply to them, so that a file cutter lint passes is one the workflows can use. cutter init writes .config/cutter.yml for a project that has none, and lists the inputs to delete from your workflows, or the jobs to add to them. Each release of Cutter publishes cutter as an archive for each platform: Get the command line.
cutter reads your repository's files on disk, and asks git for the repository's root, its files, and its tags. It asks GitHub nothing, and needs no token. The same rules apply on a person's computer and in a CI job.
This page describes the cutter of the release whose documentation you are reading. cutter --version shows which release yours came from, and cutter --help, or cutter help COMMAND, shows the help of yours.
cutter COMMAND [OPTION...]
| Command | What it does |
|---|---|
cutter lint [FILE...] |
Checks .config/cutter.yml and each changelog it lists. |
cutter init |
Writes .config/cutter.yml for a project that has none. |
cutter help [COMMAND] |
Shows the help of cutter, or of COMMAND. |
- An option goes before or after the command, so
cutter --json lintandcutter lint --jsondo the same. Every word after--is an operand, not an option. - Write each command and option in full.
cuttertakes no abbreviation, socutter lint --form jsonstops withunknown option --form; did you mean --format?, and exit status 2. An abbreviation would mean another option once a longer one starts the same way. - A command refuses an option it doesn't take, such as
cutter lint --force, with exit status 2, so that no option you give passes in silence. -hor--helpanywhere before--shows the help of the command on the line, or ofcutter, on standard output, and runs nothing, whatever else the line holds. The help of a command starts with example command lines, then says what the command does, its usage, its options, and the exit statuses, and ends with a link to the command's section of this page. The help ofcutterends with a link to this page, and with where to ask questions and report a problem.--versionshows the version, and runs nothing.cutterwith no command shows brief help on standard error, and exits with 2. It says whatcutterdoes, gives two example command lines, lists the commands, and says to runcutter --helpfor every option.
Every command takes these, except that cutter help takes no --format or --json:
| Option | What it does |
|---|---|
-C DIR, --directory DIR |
Runs as if cutter started in DIR. cutter finds the git repository that holds DIR, and reads the paths you give, FILE and --config FILE, from DIR, as git -C does. |
--config FILE |
Uses FILE as the settings file, in place of .config/cutter.yml at the repository's root. cutter lint reads - as standard input; cutter init writes FILE, and refuses -. |
--format FORMAT |
Writes the answer in FORMAT: text, the default, or json, and for cutter lint also github. A command refuses a format it doesn't write. |
--json |
Does what --format json does. |
-q, --quiet |
Leaves out the line that sums up the answer. A JSON document stays whole. |
--no-color |
Writes no color, as when NO_COLOR is set. |
-h, --help |
Shows the help of cutter, or of the command, and runs nothing. |
--version |
Shows cutter and the version of the release it came from, and runs nothing. A copy of Cutter's repository shows cutter unreleased. |
--debug |
Writes each git command cutter runs on standard error, and, after an unexpected error, its trace. |
cutter init takes five more, which cutter init describes: --force, -n or --dry-run, --changelog PATH, --package PREFIX=CHANGELOG, and --no-input.
cutter lint [FILE...] [OPTION...]
Checks a settings file, and each changelog it lists, by the rules Cutter's workflows apply to them, with the code those workflows run. It writes each problem it finds on standard output, and exits with 1 when it finds one, and with 0 when it finds none.
The settings file is, of these, the first that applies:
- Each FILE you give, and the file you give with
--config, read from the folder-Cgives, or the foldercutterstarted in.--config -reads standard input, whichcutter lintcalls(standard input). .config/cutter.ymlat the root of the git repository.- No file. With none,
cutter lintchecksCHANGELOG.md, the changelog the workflows read when no input or setting gives another.
Each changelog the settings list, once, by its path from the repository's root: the changelog setting, or each package's changelog in packages. With a settings file that holds only a build-cop key, cutter lint checks CHANGELOG.md, the default of the release and version workflows' changelog input.
Each problem is in the words of Cutter's workflows, where they have one, so the message cutter lint writes is the one a run would stop with:
- In a settings file, each reason The settings file gives for a file Cutter can't use, and those the build cop's adds. For a settings file Cutter can't use,
cutter lintchecks no changelog, since the workflows stop before they read one. - In a changelog, that it doesn't exist, is a symbolic link, or isn't UTF-8, and otherwise every problem the release workflow's reader finds, such as a heading under
## [Unreleased]that Cutter doesn't read, all in one run, where a run of the release workflow stops at the first.
cutter lint reads no workflow. A changelog that only a workflow's with: gives, as changelog: docs/CHANGELOG.md, isn't checked; with no settings file, cutter lint checks CHANGELOG.md in its place.
It refuses, with exit status 2, a folder in no git repository, a FILE or --config file it can't read, and a .config/cutter.yml that is a symbolic link, or is in a folder that is one, since the link could take the read outside the repository. A FILE or --config file may be anywhere you choose.
Text, the default: each problem as FILE:LINE:COLUMN: message when it has a place, FILE:LINE: message when it has a line alone, and FILE: message when it has neither (A problem's place), then a line that counts the problems and the files they are in. With no problem, a line that lists the files it read. -q leaves out that last line, so a check that passes writes nothing:
CHANGELOG.md:10:1: has ### Improved under ## [Unreleased], where Cutter reads only ### Added, ### Changed, ### Deprecated, ### Removed, ### Fixed, ### Security
1 problem in 1 file.
No problems in .config/cutter.yml, CHANGELOG.md.
On a terminal, cutter lint writes each file with a problem in bold, and the last line in green or red: Color.
JSON, with --format json or --json: one document, which JSON documents describes, even with -q.
GitHub, with --format github: each problem as a workflow command that makes an error annotation in a GitHub Actions job, ::error file=FILE,line=LINE,col=COLUMN::message, leaving out the properties the problem's place lacks, then the line that counts them, unless -q:
::error file=CHANGELOG.md,line=10,col=1::has ### Improved under ## [Unreleased], where Cutter reads only ### Added, ### Changed, ### Deprecated, ### Removed, ### Fixed, ### Security
1 problem in 1 file.
A place is a line and a column, each an integer counted from 1. cutter lint gives one where the file it read has it:
- In a changelog, the line of the
###heading Cutter doesn't read, or of the first entry that comes before the first heading, at column 1, where the reader finds a heading and an entry. Lines are counted in the file as it is, so a line that a comment or a code block hides counts. - In the settings file, for a file that isn't YAML, the line and column where the YAML reader stopped, which its message also gives, as
at line 2 column 3. - In the settings file, for any other problem, the place of the key the problem names: its key for a problem about a value, and the item for a problem about an item of a list. Where a key is given twice, the last, whose value Cutter reads.
- Nowhere else. A problem about a whole file, such as
does not exist,has no ## [Unreleased] heading, orit is not a mapping, has no place.
The text gives FILE:LINE:COLUMN: as compilers and linters do, so an editor or a CI log's page can go to the problem.
Check the settings file and the changelog of the repository you are in, before you push:
cutter lintCheck a project in another folder:
cutter lint -C path/to/invoiceCheck settings an editor or a script holds, before you save them, from standard input:
printf 'title: 3\n' | cutter lint --config -(standard input):1:1: title is not a string
1 problem in 1 file.
It exits with 1. It still needs a git repository: it reads the changelogs the settings list from that repository's root.
In a step of a GitHub Actions job, with cutter on the job's PATH, annotate each problem, and fail the step when there is one:
- run: cutter lint --format githubIn a script, read the problems from JSON, here with jq:
cutter lint --json | jq -r '.problems[] | .file + ": " + .message'cutter init [OPTION...]
Writes .config/cutter.yml at the root of the git repository, or the file you give with --config, for a project that has none, with each setting in which the project differs from the defaults of Cutter's workflows. It takes the settings from the inputs your workflows give Cutter's workflows, and from what the repository holds. It writes no other file and changes no workflow: it lists the inputs to delete, and, for a project whose workflows call none of Cutter's, shows the jobs to add.
Set up a project with cutter init walks through a run.
cutter init takes these beyond the options every command takes:
| Option | What it does |
|---|---|
--force |
Writes over a settings file that exists, and keeps each setting of it that cutter init doesn't write, such as backports and version-files. Refuses, with exit status 2, a file Cutter can't use. |
-n, --dry-run |
Shows the file it would write, and the rest of its answer, and writes nothing. |
--changelog PATH |
Answers that the repository releases one project, with the changelog at PATH, from the repository's root. |
--package PREFIX=CHANGELOG |
Answers that the repository releases packages apart, one with the tag prefix PREFIX and the changelog at CHANGELOG. Give one for each package. |
--no-input |
Asks nothing, and stops with exit status 2 when it needs an answer. |
It takes no operand: cutter init extra stops with exit status 2.
- Each
.ymland.yamlfile in.github/workflows, and in each, the jobs whoseuses:holds the path of one of Cutter's three workflows,setdef/Cutter/.github/workflows/release.yml,version.yml, orbuild-cop.yml, at any ref, with the owner's and the repository's names in any case. From each such job, it takes the inputs the settings file replaces: the release and version workflows'changelog,packages,record-command,title, andrelease-without-tag, and the build cop'sbranches,per-push-workflow, anddays. - Each
CHANGELOG.mdthat git tracks, and the repository's tags, to learn what the repository releases, when no workflow says.
It reads the settings file it would write over only with --force, for the settings it doesn't write, such as backports and version-files, which no input gives.
When a job calls the release or version workflow, its inputs say what the repository releases, and cutter init moves them; it then refuses --changelog and --package, with exit status 2, since either would change what the repository releases.
Otherwise, a repository with one CHANGELOG.md or none, and no tag with a prefix, such as invoice/v0.1.0, releases one project, and cutter init asks nothing. With several changelogs, or tags with a prefix, it asks on a terminal whether the repository releases one project or packages apart, and proposes for each changelog in a folder the prefix of the tags whose prefix is the folder's path or name, or else the folder's name and /:
The repository has 3 changelogs, and tags with the prefixes invoice/ and receipt-:
CHANGELOG.md
gems/invoice/CHANGELOG.md
gems/receipt/CHANGELOG.md
Does it release
1 one project, with CHANGELOG.md
2 packages apart: invoice/ with gems/invoice/CHANGELOG.md, receipt- with gems/receipt/CHANGELOG.md
Answer 1 or 2:
It asks again after an answer that is no choice's number. --changelog or --package answers instead. Where standard input is no terminal, as in CI, or with --no-input, it asks nothing, and stops with exit status 2, saying which flags to pass.
The file: .config/cutter.yml, or the file you give with --config, read from the folder -C gives. cutter init makes each folder of the path that is missing. It writes the file under another name beside it and then renames it, so an interrupted cutter init leaves the settings file whole or absent. The file holds:
- a first line that points editors at Cutter's JSON Schema,
schema/cutter.schema.json, at the commit every job that calls Cutter pins, when they pin one commit by its full SHA, and otherwise at the commit of Cutter thatcutterwas built from; with neither, the line is left out; - each setting whose value differs from the default of the input it replaces, every string in double quotes; and
{}, when no setting differs.
When the file exists, cutter init writes nothing, and exits with 1, unless you give --force. With --force, cutter init reads the file first, and keeps every setting of it that cutter init doesn't write, which is every one but the release settings and the build cop's: backports and version-files. The new file holds those after the settings cutter init writes, each string in double quotes. When it writes packages, each package keeps the version-files of the file's entry with the same prefix, and a package the new list lacks loses its entry with them. A file Cutter can't use stops it, with exit status 2, since replacing it would drop a setting that Cutter can't read: fix the file, or delete it, and run cutter init again. Before it writes, it checks the file by the workflows' rules, and refuses, with exit status 2, a file they couldn't use, such as one with --changelog ../CHANGELOG.md. It stops with exit status 2, and writes nothing, when .config is a symbolic link, and at a workflow that is one, or is in a folder that is one, since the link could take the read or the write outside the repository.
The inputs that move. Cutter reads the release and version workflows' settings all from the file or all from their inputs, and the build cop's the same way, as The settings file says. So when one input of a group can't move, every input of that group stays on the workflows, and cutter init lists them to keep, with the reason by the one that can't. An input can't move when its value is an expression, ${{ ... }}, which GitHub works out only in a run, when its value is of the wrong type, or when it is a packages input Cutter can't read. The other group still moves. When no group can move, and the file would hold nothing else, cutter init writes no file, and exits with 1, with the reason.
Two jobs that give one setting two values stop it, with exit status 2, naming both: the release job in .github/workflows/ci.yml gives title "Invoice", and the release job in .github/workflows/other.yml gives "Receipt".
The jobs to add, for a repository whose workflows call none of Cutter's: the version job and the release job, with if: ${{ !cancelled() }} on the release job, each uses: pinned at the commit of Cutter that cutter was built from, with the release's tag in a comment, as Getting started shows them in a whole CI workflow. cutter run from a copy of Cutter's repository pins the commit checked out there, with unreleased in the comment.
Text, by default, on standard output: which file it wrote, or with --dry-run the file it would write, indented; the inputs to delete; the inputs to keep; the jobs to add; and a line that says what to run next, which -q leaves out. For a project whose CI workflow gives the release workflow title and record-command:
Wrote .config/cutter.yml.
Delete these inputs from your workflows, which .config/cutter.yml holds now:
.github/workflows/ci.yml, job release: title, record-command
Next, delete those inputs, run cutter lint to check .config/cutter.yml, then commit your changes and push them.
With --format json, or --json, one document, which JSON documents describes. cutter init writes no annotations, and refuses --format github.
See what cutter init would write, and write nothing:
cutter init --dry-runWrite the file for a repository of two gems that release apart, each with its tag prefix, and ask nothing:
cutter init --package invoice/=gems/invoice/CHANGELOG.md --package receipt/=gems/receipt/CHANGELOG.mdThe file then holds, after the line for editors:
packages:
- prefix: "invoice/"
changelog: "gems/invoice/CHANGELOG.md"
- prefix: "receipt/"
changelog: "gems/receipt/CHANGELOG.md"Write the file somewhere else:
cutter init --config tmp/cutter.ymlCutter's workflows read only .config/cutter.yml at the root, so a file elsewhere is one to read or compare, not one they use.
cutter help [COMMAND]
Shows the help of cutter, or of COMMAND, on standard output, and exits with 0. cutter --help and cutter COMMAND --help show the same. It refuses, with exit status 2, a word that is no command's name, more than one word, and --format and --json, since it writes no document: cutter help --json stops with cutter: help takes no --json; run cutter help help to see its options.
| Status | Meaning |
|---|---|
| 0 | No problem. For cutter init, the file written, or shown with --dry-run. |
| 1 | cutter lint found a problem in a file it checked. cutter init wrote nothing, since the settings file exists and you gave no --force, or since no input could move and the file would hold no setting. |
| 2 | cutter couldn't answer: a mistyped command or option, an option or format the command doesn't take, no git repository, a file it can't read or write, a question it can't ask, settings cutter init would write that Cutter's workflows couldn't use, a settings file cutter init --force would write over that Cutter can't use, or an unexpected error. |
| 130 | Interrupted, with Interrupted on standard error. |
| 141 | The program that reads cutter's standard output stopped reading, as head -1 does, and cutter stopped, with no message. |
A CI job that runs cutter lint can tell your files' problems, 1, from a mistake in the job's command line, 2.
In cutter lint | head -1, bash and zsh show 141 for cutter, as they do for grep and git there.
cutter writes its answer on standard output, and everything else on standard error: a question, the brief help of cutter with no command, what --debug shows, and the message that stops it.
A refusal is one line, cutter: and what cutter found and what to do, such as cutter: no git repository at /; run cutter lint in one, or name one with -C DIR. For a command, option, or format cutter lacks, it names the closest one, when one is close, and otherwise says which help lists them. For a format, that is the help of the command, since the commands write different formats: cutter lint --format yaml stops with cutter: unknown format yaml; run cutter help lint to see the formats.
An unexpected error is one line that gives its class and says to run cutter again with --debug. With --debug, or DEBUG set and not empty, the line says to report it on the Cutter forum, with its address, and the error's trace follows. The help of cutter gives the same address for questions and problems.
Without --debug, no message holds more of a file than a key's path, or the words of the command line: a refusal's message comes from Cutter's workflows, whose messages hold no more, and an unexpected error shows only its class. A trace from --debug can hold more.
A path, a job's name, or a changelog's heading can hold a character that a terminal acts on instead of showing, such as an escape that moves the cursor, or a line break, after which GitHub's runner reads a workflow command. In text, cutter writes a name that holds such a character in double quotes, with every character but printable ASCII escaped, as "bad\ename.md", and escapes such a character in a message. In JSON, it escapes the character as JSON does. In the github format, it escapes what GitHub's runner decodes, and in the file's name the colon and the comma too.
cutter writes color only in text, and only on a stream that a terminal shows, each stream judged apart, so standard error keeps its color while standard output goes to a pipe. cutter follows the first of these that applies:
--no-color, orNO_COLORset and not empty: no color.FORCE_COLORset and not empty: color, on any stream.TERM=dumb: no color.
JSON and the github format never hold color.
Each command writes one document on standard output, with every key always there, so a script reads it without checking which keys exist. A run that stops with a message on standard error, with exit status 2, or cutter init's 1, writes no document.
{
"files": [
".config/cutter.yml",
"CHANGELOG.md"
],
"problems": [
{
"file": "CHANGELOG.md",
"line": 10,
"column": 1,
"message": "has ### Improved under ## [Unreleased], where Cutter reads only ### Added, ### Changed, ### Deprecated, ### Removed, ### Fixed, ### Security"
}
]
}| Key | Value |
|---|---|
files |
The name of each file cutter lint read: the settings files, then the changelogs. |
problems |
Each problem, in the order the text gives them: an empty list when there is none. |
problems[].file |
The name of the file the problem is in. |
problems[].line, problems[].column |
The problem's place, each an integer counted from 1, or null when the problem has none: A problem's place. |
problems[].message |
The problem, in the words the text gives after FILE: . |
cutter lint writes the document with exit status 0 or 1.
{
"path": ".config/cutter.yml",
"written": false,
"text": "# yaml-language-server: $schema=https://raw.githubusercontent.com/setdef/Cutter/54e511b06427cc64f63611bb5d41a0a3515a20b1/schema/cutter.schema.json\nbuild-cop:\n days: 5\n",
"delete": [
{
"file": ".github/workflows/build-cop.yml",
"job": "build-cop",
"input": "days"
}
],
"keep": [
{
"file": ".github/workflows/ci.yml",
"job": "release",
"input": "title",
"reason": "its value is an expression, which GitHub works out only in a run"
}
],
"add": null
}| Key | Value |
|---|---|
path |
The settings file's name, as you gave it with --config, or .config/cutter.yml. |
written |
true when cutter init wrote the file, and false with --dry-run. |
text |
What the file holds, or with --dry-run would hold. |
delete |
Each input to delete from your workflows, since the file holds it: its workflow's file, its job, and the input's name. |
keep |
Each input to keep, with the same keys, and reason: why it can't move, or null for an input that stays only because another of its group can't. |
add |
The lines of the jobs to add to your CI workflow, indented to go under jobs:, as one string; or null when your workflows call Cutter, or cutter has no commit to pin. |
| Variable | Effect |
|---|---|
DEBUG |
Set and not empty, does what --debug does. |
NO_COLOR |
Set and not empty, turns color off: Color. |
FORCE_COLOR |
Set and not empty, turns color on, on any stream, unless color is off. |
TERM |
dumb turns color off, unless FORCE_COLOR turns it on. |
cutter reads no variable whose name starts with CUTTER_. The workflows' steps set those, and a record-command that runs cutter inherits them, so cutter answers there as on your computer. git, which cutter runs, reads the environment as it always does.
- It asks GitHub nothing, uses no network, and needs no token.
- It runs nothing your settings give, such as the
record-command. cutter initwrites no workflow, and no file but the settings file and the folders on its path. It moves no input but those the settings file replaces.- It gives no line or column for a problem about a whole file.
- It installs nothing, and updates nothing, itself included.
cutter lintchecks by the rules of the release it came from. Acutternewer than the release your workflows pin can pass a setting that those workflows refuse, such as a key they don't read. Use thecutterof the release you pin: Get the command line.--forceforgets the release settings and the build cop's of the file it writes over.cutter initbuilds those from your workflows and your repository, so a setting you put in the file by hand, and then deleted from your workflows, is gone from the file it writes. It keepsbackports,version-files, each package'sversion-filesfor a package it writes, by itsprefix, and any other setting it doesn't write. Run it with--dry-runfirst, and compare.- Workflows pinned before v0.6.2 read the file in other ways. Cutter reads the release settings from the file from v0.4.9 on, and the build cop's from v0.5.0 on, and before v0.6.2 a file with none of the release settings put the release and version workflows on their inputs' defaults.
cutter initcan't learn which release a pin is without asking GitHub, so it can't warn you. Pin v0.6.2 or later before you delete the inputs it lists. - A file another program makes at the path while
cutter initruns is replaced.cutter initchecks that the path is free, and then renames its file over it.