|
3 | 3 | A command-line interface (CLI) tool for interacting with the PagerTree API. This tool allows users to manage alerts and other resources in PagerTree directly from the terminal. Built with Python and `click`, it supports nested commands, pagination, and table-formatted output. |
4 | 4 |
|
5 | 5 | ## Features |
6 | | -- Manage PagerTree alerts (`alerts create`, `alerts list`, `alerts show`). |
7 | | -- Pagination support with `--limit`, `--offset`, and `--all` options. |
| 6 | +- Manage PagerTree objects such as alerts, teams, broadcasts, and users. |
| 7 | +- Pagination support with `--limit`, `--offset`, and `--search` options. |
8 | 8 | - Pretty table output using `tabulate`. |
9 | 9 | - Environment variable configuration with `.env` file support. |
10 | | -- Extensible design with dynamic command registration. |
| 10 | +- Support for configuration files `config.ini`. |
| 11 | + |
| 12 | +## Usage |
| 13 | +```bash |
| 14 | +pagertree [OPTIONS] COMMAND [ARGS...] |
| 15 | +``` |
| 16 | + |
| 17 | +Run `pagertree --help` to see the list of available commands and options. |
| 18 | + |
| 19 | +### Example Usage |
| 20 | +- List all alerts: |
| 21 | + ```bash |
| 22 | + pagertree alerts list |
| 23 | + ``` |
| 24 | + OR |
| 25 | + ```bash |
| 26 | + pagertree alerts list --limit 10 --offset 0 |
| 27 | + ``` |
| 28 | + OR |
| 29 | + ```bash |
| 30 | + pagertree alerts list --search "NEEDLE IN THE HAYSTACK" |
| 31 | + ``` |
| 32 | +- Create a new alert: |
| 33 | + ```bash |
| 34 | + pagertree alerts create --title "Out of Memory" --alias "oom" --team-ids "01JT13C98M186XA3QTRFC250MT" |
| 35 | + ``` |
| 36 | +- Show details of a specific alert: |
| 37 | + ```bash |
| 38 | + pagertree alerts show "01JT13CYDAMAJDM0G8HR1X8BMY" |
| 39 | + ``` |
| 40 | + OR |
| 41 | + ```bash |
| 42 | + pagertree alerts show --alias "oom" |
| 43 | + ``` |
| 44 | +- List all teams: |
| 45 | + ```bash |
| 46 | + pagertree teams list |
| 47 | + ``` |
| 48 | +- List current on-call users for a specific team: |
| 49 | + ```bash |
| 50 | + pagertree teams current-oncall "01JT13C98M186XA3QTRFC250MT" |
| 51 | + ``` |
| 52 | +- Run a command with a specific configuration file: |
| 53 | + ```bash |
| 54 | + pagertree --config config.ini alerts list |
| 55 | + ``` |
| 56 | + OR |
| 57 | + ```bash |
| 58 | + PAGERTREE_CONFIG=config.ini pagertree alerts list |
| 59 | + ``` |
| 60 | + |
| 61 | +## Pre-Built Binaries |
| 62 | +Pre-built binaries for various platforms are available in the [releases](https://github.com/PagerTree/pager_tree-cli/releases) section. You can download the appropriate binary for your operating system and architecture. |
| 63 | + |
| 64 | +### Source Code Installation & Development |
| 65 | +1. Clone the repository: |
| 66 | + ```bash |
| 67 | + git clone |
| 68 | + cd pager_tree-cli |
| 69 | + ``` |
| 70 | +2. Install dependencies: |
| 71 | + ```bash |
| 72 | + source venv/bin/activate |
| 73 | + pip install -r requirements.txt |
| 74 | + ``` |
| 75 | +3. Make the script executable: |
| 76 | + ```bash |
| 77 | + chmod +x pagertree.py |
| 78 | + ``` |
| 79 | +4. Run the script: |
| 80 | + ```bash |
| 81 | + python ./pagertree.py |
| 82 | + ``` |
0 commit comments