Usage
Install from PyPi:
pip install sudoblark-github-cli
And off you go. Run --help
commands are available at all levels for further information, get
started by simply running:
sudoblark-github-cli --help
For example, the --help
interface for version 1.0.0
shows:
Usage: sudoblark-github-cli [OPTIONS] COMMAND [ARGS]...
CLI tooling intended to automate operations against GitHub within a CI/CD, or other such programmatic. setting. All commands require a valid GITHUB_TOKEN environment variable to operate.
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --log-level -log [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL] Set the logging level for the application, can also override with LOG_LEVEL environment variable [default: INFO] │
│ --log-format,--format TEXT Set the logging format for the application, can also override with LOG_FORMAT environment variable [default: %(asctime)s - %(module)s - %(levelname)s - %(message)s] │
│ --version -v Show the application's version and exit. │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ debug-log-config Outputs log messages at all levels, intended as an easy test for your log config. │
│ pull-request Interact with pull requests │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Each and every command will have further information discoverable via simply using --help
to discover more about it.
For example, if you with to know what pull request operations are available:
Usage: sudoblark-github-cli pull-request [OPTIONS] COMMAND [ARGS]...
Interact with pull requests
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --log-level -log [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL] Set the logging level for the application, can also override with LOG_LEVEL environment variable [default: INFO] │
│ --log-format,--format TEXT Set the logging format for the application, can also override with LOG_FORMAT environment variable [default: %(asctime)s - %(module)s - %(levelname)s - %(message)s] │
│ --version -v Show the application's version and exit. │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ create-comment Create a new comment on a given pull request on a given repository. │
│ read-comment Read comments on a given pull request on a given repository, optionally filtered by user, and output in a verbose table. │
│ update-comment Update an explicit comment, or the last comment by a given user, on a given pull request on a given repository. │
│ delete-comment Delete an explicit comment, or the last comment by a given user, on a given pull request on a given repository. │
│ list Output a concise table of pull requests for the given repository. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
And then you think, hey, I want to delete that nasty comment reviewer number 2 added to my PR you can see more
information about how to do so with yet another --help
command:
Usage: sudoblark-github-cli pull-request delete-comment [OPTIONS]
Delete an explicit comment, or the last comment by a given user, on a given pull request on a given repository.
Examples:
Delete last comment by a given user:
delete-comment --repository sudoblark.python.core --pull-request-number 3 --author sudoblark-bot
Delete an explicit comment ID:
delete-comment --repository sudoblark.python.core --pull-request-number 3 --comment-id 2679890418
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --repository -re TEXT Repository to query in form of owner/repository. [default: None] [required] │
│ * --pull-request-number -pr INTEGER Number of the pull request we wish to delete a comment on [default: None] [required] │
│ --author -au TEXT Author to filter comments for. [default: NA] │
│ --comment-id -cid INTEGER Specific comment ID to delete [default: -1] │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
And there you go. The CLI is considered living documentation in and of itself. If you find any of the --help
information lacking,
wish to see more commands adding, or find a typo... raise an issue on the repository here.