Commands
The CLI installs one executable, all-contributors, and it takes a command as its first argument. This page lists the commands and the flags they share. The examples write all-contributors and leave out the prefix that your package manager needs, such as npx or pnpm, which Install the CLI explains.
If you run all-contributors without a command, it shows a menu with add, generate and check. The init command is only available when you name it.
Commands
Section titled “Commands”all-contributors init
Section titled “all-contributors init”Prepares a project to use the CLI. It asks a series of questions, then creates .all-contributorsrc in the current directory with your answers. It also creates the file for the contributors if it doesn’t exist, adds a contributors section with markers to it, and adds a badge to the badge file when you asked for one. The command reads your origin remote to suggest the repository name and owner, so it fails in a directory without one.
If the file already has a second-level heading called “Contributors”, the CLI adds the markers below that heading. Otherwise it appends a “Contributors” section at the end of the file.
all-contributors add
Section titled “all-contributors add”all-contributors add <username> <contributions>Adds a contributor, or changes the contributions of someone who is already listed, and then regenerates the files. contributions is a comma-separated list of the keywords from the emoji key. If you leave out the username or the contributions, the command asks for them. The behaviour for existing contributors is described in Add contributors.
| Flag | Description |
|---|---|
--url <address> |
Makes the contributions you add link to this address. |
--commit |
Commits the changed files, as the commit option does. |
all-contributors generate
Section titled “all-contributors generate”all-contributors generateReads the contributors list from .all-contributorsrc and rewrites the table and the badge between their markers in every file listed under files. A file without a pair of markers keeps that part unchanged, and the command doesn’t report it. A file in the files list that doesn’t exist makes the command fail.
all-contributors check
Section titled “all-contributors check”all-contributors checkCompares the contributors of the repository on the host with the contributors in .all-contributorsrc and prints the differences. Check for missing contributors explains the output.
Flags for every command
Section titled “Flags for every command”| Flag | Alias | Description | Default |
|---|---|---|---|
--config <path> |
-c |
The path of the configuration file. | .all-contributorsrc in the current directory |
--contributorsSortAlphabetically |
Sorts the generated table by name. | false |
|
--help |
-h |
Prints the help. | |
--version |
-v |
Prints the version. |
Configuration file
Section titled “Configuration file”The CLI reads .all-contributorsrc from the current directory, and --config points it to a file elsewhere. If the default file doesn’t exist, the CLI starts without it, which is what init relies on, but a file you name with --config must exist. When the file contains small JSON errors, such as a trailing comma, the CLI fixes them and saves the corrected file.
Settings in the file win over the same flag on the command line, so --contributorsSortAlphabetically only has an effect when the file doesn’t set that option. The configuration options lists every setting.
Next steps
Section titled “Next steps”- Quick start walks through the commands in order.
