API reference#
Generated from the docstrings and type annotations in src/. Only the names on this page are
public and follow semantic versioning (while 0.x, a breaking change bumps the minor version
and is listed in the changelog); every other module is internal. tests/test_api_reference.py
fails if a name in graftkit.__all__ or graftkit.testing.__all__ is missing.
Extensions#
A repository adds commands with an Extension, exposed as an entry point in the
graftkit.extensions group (<name> = "<package>.graftkit:EXTENSION") and named by
[cli] extension = "<name>" in its graftkit.toml.
Declaring commands#
Re-exported from cli-interview-kit: how commands, flags and interview questions are declared.
One command. |
|
A command line that runs a command, shown in |
|
A plain option or positional argument; not an interview question. |
|
A command's questions and consents, and where their dynamic parts come from. |
|
One interview question. |
|
A confirmation a command may need before it acts. |
|
What a command's run function receives. |
|
Styled output and interactive prompts for a command. |
|
An expected failure, reported as its message without a traceback. |
|
Reject a blank answer. |
|
Return a condition: |
Testing#
Helpers for testing an extension, or the core. The pytest plugin, registered as graftkit
wherever the package is installed, provides them as fixtures: graftkit_root(config) makes a
temporary root with the developer’s GRAFTKIT_* variables and user config kept out,
graftkit_run(root, *args, ...) is run, fake_github is a fresh FakeGitHub and
fake_git a fresh FakeGit.
Run the CLI in a root, in this process, and capture what it printed. |
|
What a command run printed and returned. |
|
Create a root: a folder holding |
|
Fail unless an extension follows the command standard. |
|
An in-memory |
|
An in-memory |
|
A clone |
|
A pull request |
|
Keep the developer's environment out of a test: root, user config, settings, cache. |