- Author: setdef
- License: MIT
- Repository: https://github.com/setdef/Alibi
Alibi checks each alibi file you name, or each *.kdl file directly in .config/alibi/ when you name none. For each one, it prints whether it passed, and a line for each match that has no alibi. alibi list prints the alibis in those files instead. README.md says how Alibi reads an alibi file and what it prints.
This page is generated from alibi.usage.kdl. Regenerate it with usage generate markdown --file alibi.usage.kdl --out-file docs/reference/cli.md and never edit it by hand.
Check every alibi file in .config/alibi/
Runs each *.kdl file directly in .config/alibi/, in order of name.
alibiCheck one alibi file
alibi .config/alibi/rubocop-disable-never.kdlCheck each alibi file in turn
alibi a.kdl b.kdlCheck a file whose name has no . or /
Every word after -- is an alibi file.
alibi -- unsafeList every alibi in .config/alibi/
Prints each alibi's ID and path, then its snippet and its four answers.
alibi listList the alibis in each alibi file
alibi list a.kdl b.kdlList one alibi by its ID
Give --id again for more alibis in the same alibi file.
alibi list .config/alibi/rubocop-disable-never.kdl --id 0a916d4Write a new alibi file
Writes the alibi file whole, or nothing. Without --about-file, an editor opens for the about when standard input is a terminal.
alibi init .config/alibi/rubocop-disable-never.kdl "--files=**/*.rb" "--pattern=#\s*rubocop\s*:\s*disable\b" --about-file why.txtStart from an example
Add --files=GLOB to fit the example to your folders.
alibi init .config/alibi/rubocop-disable-never.kdl --example rubocop-disable-neverStart writing an alibi for a match
Asks the first of four questions, and writes the alibi once each has an answer.
alibi add .config/alibi/rubocop-disable-never.kdl lib/invoice.rb:2Change the reason of an alibi
The other answers stay as they were.
alibi amend .config/alibi/rubocop-disable-never.kdl 0a916d4 --reason-file reason.txtWrite an alibi for each match in turn
At a terminal, asks the four questions for each match in turn, and writes each alibi as soon as it is answered.
alibi add .config/alibi/rubocop-disable-never.kdlRemove an alibi by its ID
Writes the alibi file whole, without that alibi. Give more IDs to remove more.
alibi remove .config/alibi/rubocop-disable-never.kdl 0a916d4Remove every alibi that matches nothing
The alibis a check calls stale.
alibi remove .config/alibi/rubocop-disable-never.kdl --stalePrint the version
alibi --version- Usage:
alibi [--help] [--version] [FILE]… [SUBCOMMAND]
[FILE]…— An alibi file to check, such as.config/alibi/rubocop-disable-never.kdl. A word with a.or a/in it is an alibi file, and so is every word after--, which ends the options. A word with neither is an error: write ./unsafe or -- unsafe for a file of that name. An alibi file with noformatnode was written by hand, and Alibi reads only an alibi file that it wrote and sealed, so it is an error that says how to create the file anew.
--help— Prints how to use Alibi on standard output, and exits with 0, without checking any alibi file, wherever it stands on the command line and whatever else is there: an alibi file, another flag, or a mistake. With --version, prints the version first. After a command, as in alibi add FILE --help, it prints how to use that command.--version— Prints the version of Alibi on standard output and exits with 0, without checking any alibi file.
| Code | Meaning |
|---|---|
0 |
Every alibi file passed, or the command line was --version or --help. |
1 |
An alibi file failed, and none had an error. |
2 |
An error: a command line Alibi can't use, such as an unknown option or a word with no . or / in it; an alibi file that is missing, unreadable, written by hand, or isn't valid; a glob that matches no file; a pattern Alibi refuses; a matched file that isn't UTF-8 text; no git on the PATH; or a bare alibi with no *.kdl file in .config/alibi/. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops, with nothing half written: a check and a list only read, and alibi init, alibi add, alibi amend, and alibi remove remove their temporary file. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
- Usage:
alibi add [FLAGS] [FILE] [MATCH]
Writes an alibi for the match that MATCH names into FILE, an alibi file that alibi init wrote, sealed, after four questions that it asks one at a time: what was tried, to fix the code instead; the evidence; why a fix is impossible; and the reason the match is necessary at its place. Each answer comes from the file its flag names, with - for standard input, or else from the editor that VISUAL or EDITOR names when standard input is a terminal. With neither, it shows the next question, its flag, and how to stop, writes nothing, and exits with 2. An answer with nothing in it stops the command, and nothing is written: fix the code instead. It chooses the snippet, the fewest lines around the match that occur once in its file, and writes the alibi file whole. It finds the matches by checking the project as a check does, so it needs git. With no MATCH, at a terminal, it goes through each match that has no alibi, in the order the check prints them, asking the four questions in the editor for each and writing each alibi as soon as its four answers are in. An answer with nothing in it leaves that match for a fix of the code, and the walk goes on to the next. With no terminal, or with --no-input, it asks nothing, writes nothing, and exits with 2, with the command line for the first match that has no alibi and how many there are.
[FILE]— The alibi file to add the alibi to, such as.config/alibi/rubocop-disable-never.kdl, in format 1, sealed, as alibi init writes it. A word with a.or a/in it is an alibi file, and so is every word after--. An alibi file written by hand is an error.[MATCH]— The match to excuse, as its path and the line where it starts, such as lib/invoice.rb:2, which is how the check prints the line of a match with no alibi. When several matches start on that line, add the column where the one you mean starts, such as lib/invoice.rb:2:20. Without it, at a terminal, alibi add goes through each match with no alibi in turn, and takes no flag that names a file of answers.
--evidence-file <PATH>— The file that holds the answer to the second question, evidence: what shows that the match is necessary at its place. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise alibi add shows the question and stops.--help— Prints how to use alibi add on standard output, and exits with 0, without writing anything, wherever it stands on the command line and whatever else is there.--no-input— Never opens an editor, and never waits for typing: a question that no flag answers is shown, and nothing is written. With no MATCH, it refuses to go through the matches, and gives the command line for the first. Use it in a script.--reason-file <PATH>— The file that holds the answer to the fourth question, reason: why the match is necessary at its place, for a reader who wasn't there. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise alibi add shows the question and stops.--tried-file <PATH>— The file that holds the answer to the first question, tried: what was tried, to fix the code instead. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise alibi add shows the question and stops.--unfixable-file <PATH>— The file that holds the answer to the third question, unfixable: why no change to the code can remove the match. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise alibi add shows the question and stops.
| Code | Meaning |
|---|---|
0 |
The alibi was written, or the walk through the matches ended, with each match written or left for a fix of the code, or no match was without an alibi, or the command line was add --help. |
1 |
Not used: add checks no alibi file. |
2 |
An error, with nothing written for the match, though the alibis that a walk wrote before it stay: a command line Alibi can't use, such as one with no argument, which prints the help of add on standard error, a missing MATCH, a flag that takes a value given more than once and no --help, or an unknown option; an alibi file that is missing, written by hand, or isn't valid; a glob that matches no file, a matched file that isn't UTF-8 text, or no git on the PATH, as in a check; a MATCH that names no match, several, or one that an alibi excuses already, or one that ends on a blank line that no line of text follows; no MATCH, with no terminal or with --no-input, which gives the command line for the first match with no alibi; no MATCH with a flag that names a file of answers; a question with no answer, which shows the question; an answer with nothing in it, which ends one match and not a walk; an editor that failed; or an alibi file that changed while the questions were asked. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops, with nothing half written and no temporary file left behind: the alibis that a walk wrote before Ctrl-C stay. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
Start writing an alibi for a match
Asks the first question, in an editor at a terminal, or shows it and stops.
alibi add .config/alibi/rubocop-disable-never.kdl lib/invoice.rb:2Write an alibi for each match in turn
At a terminal, asks the four questions for each match in turn. Anywhere else, gives the command line for the first match.
alibi add .config/alibi/rubocop-disable-never.kdl- Usage:
alibi amend [FLAGS] [FILE] [ID]
Asks the four questions of the alibi that ID names in FILE, an alibi file that alibi init wrote, again, and writes the answers in its place, whole, sealed: what was tried, to fix the code instead; the evidence; why a fix is impossible; and the reason the match is necessary at its place. Each answer comes from the file its flag names, with - for standard input, or else from the editor that VISUAL or EDITOR names when standard input is a terminal, which opens with the old answer above the question. With no terminal, an answer that no flag gives stays as it was. An answer with nothing in it stops the command, and nothing is written. It is an error when every answer is as it was, since nothing would change. It changes no path, snippet, or occurrence, so the alibi keeps its ID. It reads only the alibi file, so it needs no git and no project. An ID is an ID start, as alibi list --id takes it, and an ID that several alibis share is an error.
[FILE]— The alibi file that holds the alibi, such as.config/alibi/rubocop-disable-never.kdl, in format 1, sealed, as alibi init writes it. A word with a.or a/in it is an alibi file, and so is every word after--. An alibi file written by hand is an error.[ID]— The ID of the alibi to amend, 7 to 64 hexadecimal digits in either case, such as 0a916d4, which every line about an alibi shows. It has to start the ID of one alibi, and not of several.
--evidence-file <PATH>— The file that holds the answer to the second question, evidence: what shows that the match is necessary at its place. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise the answer stays as it was.--help— Prints how to use alibi amend on standard output, and exits with 0, without writing anything, wherever it stands on the command line and whatever else is there.--no-input— Never opens an editor, and never waits for typing: an answer that no flag gives stays as it was. Use it in a script.--reason-file <PATH>— The file that holds the answer to the fourth question, reason: why the match is necessary at its place, for a reader who wasn't there. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise the answer stays as it was.--tried-file <PATH>— The file that holds the answer to the first question, tried: what was tried, to fix the code instead. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise the answer stays as it was.--unfixable-file <PATH>— The file that holds the answer to the third question, unfixable: why no change to the code can remove the match. - reads standard input. Without it, the editor asks the question at a terminal, and otherwise the answer stays as it was.
| Code | Meaning |
|---|---|
0 |
The alibi was amended, or the command line was amend --help. |
1 |
Not used: amend checks no alibi file. |
2 |
An error, and nothing was written: a command line Alibi can't use, such as one with no argument, which prints the help of amend on standard error, no ID, a flag that takes a value given more than once, or an unknown option; an alibi file that is missing, written by hand, or isn't valid; an ID that isn't 7 to 64 hexadecimal digits, or that starts no alibi's ID or the IDs of several alibis, or that several alibis share; an answer with nothing in it; answers that are all as they were; a reason that another alibi has; or an alibi file that changed while amend ran. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops, with nothing written and no temporary file left behind. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
Change the reason of an alibi
The other answers stay as they were. At a terminal, an editor opens for each question that no flag answers, with the old answer.
alibi amend .config/alibi/rubocop-disable-never.kdl 0a916d4 --reason-file reason.txt- Usage:
alibi init [FLAGS] [FILE]
Writes a new alibi file in format 1, sealed, with no alibis: the files it applies to, the pattern it bans, and an about that says what it bans and why. It writes only a file that doesn't exist, creating the folders above it, and checks the glob and the pattern as a check would before it writes, which needs git. Give the glob with --files=GLOB and the pattern with --pattern=REGEX, or start from one of the examples with --example. The about is taken from the file --about-file names, with - for standard input, or else written in the editor that VISUAL or EDITOR names when standard input is a terminal. Run with no argument at all, it prints this page on standard error and exits with 2.
[FILE]— The alibi file to write, such as.config/alibi/rubocop-disable-never.kdl. A word with a.or a/in it is an alibi file, and so is every word after--. An alibi file that exists is an error: alibi init never replaces one.
--about-file <PATH>— The file that holds what the alibi file bans, and why the project bans it, for a reader who wasn't there when it was written: one or more lines of text. - reads standard input. Without this flag, a person at a terminal writes it in the editor that VISUAL or EDITOR names, and a command line with no terminal, or with --no-input, is an error. An about with nothing in it stops the command, and nothing is written. An example comes with an about.--example <NAME>— The name of an example alibi file, such as rubocop-disable-never, without .kdl. Its glob, its pattern, and an about taken from its opening comment come with it, so no question is asked. --files replaces the example's glob, since the folders of a project differ. An example that doesn't exist is an error that lists the names there are.--files <GLOB>— The glob of the files the alibi file applies to, from the project root, such as**/*.rb. Write it as--files=GLOB, with the whole word in double quotes: on Windows, Ruby expands a wildcard in an argument, whatever the quotes around it, unless the word starts with--. A glob that is absolute or has a..segment is an error, and so is one that matches no file of the project, as in a check.--help— Prints how to use alibi init on standard output, and exits with 0, without writing anything, wherever it stands on the command line and whatever else is there.--no-input— Never opens an editor, and never waits for typing: an about that --about-file doesn't give is an error. Use it in a script.--pattern <REGEX>— The Ruby regular expression that finds what the alibi file bans, in one line, such as# *rubocop *: *disable. Write it as--pattern=REGEX, with the whole word in double quotes, for the reason given with--files. A pattern that can match empty text, or that Ruby can't match in linear time, is an error, as in a check.
| Code | Meaning |
|---|---|
0 |
The alibi file was written, or the command line was init --help. |
1 |
Not used: init checks no alibi file. |
2 |
An error, and nothing was written: a command line Alibi can't use, such as one with no argument, which prints the help of init on standard error, a missing --files or --pattern, a flag that takes a value given more than once and no --help, an unknown option, or a word with no . or / in it; an alibi file that exists; a glob or a pattern that a check would refuse; a glob that matches no file of the project; no git on the PATH; an example that doesn't exist; an about that has no text, or that can't be taken from a file, standard input, or an editor; or a file or folder that can't be written. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops, with nothing written and no temporary file left behind. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
Write a new alibi file
Writes the alibi file whole, or nothing. Without --about-file, an editor opens for the about when standard input is a terminal.
alibi init .config/alibi/rubocop-disable-never.kdl "--files=**/*.rb" "--pattern=#\s*rubocop\s*:\s*disable\b" --about-file why.txtStart from an example
Add --files=GLOB to fit the example to your folders.
alibi init .config/alibi/rubocop-disable-never.kdl --example rubocop-disable-never- Usage:
alibi list [--help] [--id <ID>] [FILE]…
Prints each alibi in the alibi files it is given, or in every *.kdl file directly in .config/alibi/ when it is given none: a line with the alibi's ID and path, then its snippet and its four answers, indented. With --id, it prints only the alibis whose IDs start with the digits given, from one alibi file. It reads only the alibi files, and exits with 2 when any one can't be read. It works as the textconv driver of a version-control diff, so that a diff shows each alibi's ID.
[FILE]…— An alibi file to list, such as.config/alibi/rubocop-disable-never.kdl. A word with a.or a/in it is an alibi file, and so is every word after--, which ends the options. An alibi file with noformatnode was written by hand, and Alibi reads only an alibi file that it wrote and sealed, so it is an error that says how to create the file anew.
--help— Prints how to use alibi list on standard output, and exits with 0, without reading any alibi file, wherever it stands on the command line and whatever else is there.--id <ID>— Lists only the alibi whose ID starts with ID, which is 7 to 64 hexadecimal digits, from the one alibi file given, as alibi list prints it. Give --id again for more alibis: they are listed in the order the alibi file lists them, each once. An ID that starts no alibi's ID, or starts the IDs of several, is an error, and the other alibis are still listed.
| Code | Meaning |
|---|---|
0 |
Every alibi file was read and listed, or the command line was list --help. |
1 |
Not used: a list checks no alibi file. |
2 |
An error: a command line Alibi can't use, such as an option other than --help and --id, an --id with no alibi file or several, or a word with no . or / in it; an alibi file that is missing, unreadable, written by hand, or isn't valid; an --id that isn't 7 to 64 hexadecimal digits, or that starts no alibi's ID or the IDs of several alibis; or no *.kdl file in .config/alibi/. The alibis that could be listed still are. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
List one alibi by its ID
Give --id again for more alibis in the same alibi file.
alibi list .config/alibi/rubocop-disable-never.kdl --id 0a916d4- Usage:
alibi remove [--help] [--stale] [FILE] [ID]…
Takes each alibi whose ID it is given out of FILE, an alibi file that alibi init wrote, and writes the alibi file whole, sealed. An ID is an ID start, as alibi list --id takes it: 7 to 64 hexadecimal digits that an alibi's ID starts with. An ID that starts no alibi's ID, or the IDs of several, is an error, and nothing is written, as when the alibi file is missing, was written by hand, or isn't valid. Alibis with one path, snippet, and occurrence share an ID, and remove takes out every alibi that has it, and says so. With --stale and no ID it takes out every alibi that matches nothing, the ones a check calls stale, and is an error when there is none. It asks no question, since fixing the code is what leads to removing an alibi. By ID it reads only the alibi file, so it needs no git and no project; with --stale it checks the alibi file against its project, as a check does, so it needs git too.
[FILE]— The alibi file to take the alibis out of, such as.config/alibi/rubocop-disable-never.kdl, in format 1, sealed, as alibi init writes it. A word with a.or a/in it is an alibi file, and so is every word after--. An alibi file written by hand is an error.[ID]…— The ID of an alibi to remove, 7 to 64 hexadecimal digits in either case, such as 0a916d4, which every line about an alibi shows. Give more than one to remove several alibis at once. Every ID has to start the ID of an alibi, or nothing is removed. Give no ID with --stale.
--help— Prints how to use alibi remove on standard output, and exits with 0, without writing anything, wherever it stands on the command line and whatever else is there.--stale— Takes out every alibi that matches nothing: its snippet occurs nowhere in its file, or the glob doesn't match its file. These are the alibis that a check calls stale. It runs the check of the alibi file against its project to find them, so it needs git, as a check does, and it is an error when no alibi is stale. It conflicts with an ID.
| Code | Meaning |
|---|---|
0 |
The alibis were removed, or the command line was remove --help. |
1 |
Not used: remove checks no alibi file. |
2 |
An error, and nothing was written: a command line Alibi can't use, such as one with no argument, which prints the help of remove on standard error, neither an ID nor --stale, both, or an unknown option; an alibi file that is missing, written by hand, or isn't valid; an ID that isn't 7 to 64 hexadecimal digits, or that starts no alibi's ID or the IDs of several alibis; with --stale, no alibi that is stale, a glob that matches no file, a matched file that isn't UTF-8 text, or no git on the PATH; or an alibi file that changed while remove ran. |
130 |
Someone interrupted Alibi with Ctrl-C. Alibi writes alibi: interrupted on standard error, with no backtrace, and stops, with nothing written and no temporary file left behind. On Unix, it ends by SIGINT, which a shell shows as 130; on Windows, it exits with 130. |
Remove an alibi by its ID
Give more IDs to remove more alibis of the same alibi file.
alibi remove .config/alibi/rubocop-disable-never.kdl 0a916d4Remove every alibi that matches nothing
The ones a check calls stale. It is an error when there are none.
alibi remove .config/alibi/rubocop-disable-never.kdl --stale