Skip to content

Commit

Permalink
Add command reference root page, fix readme links (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan authored Nov 5, 2024
1 parent 352ba27 commit 65fd635
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ zabbix_cli/commands/_dev.py
dev/

# Auto-generated docs files
docs/guide/commands/
docs/guide/commands/*
!docs/guide/commands/index.md
docs/data
site/

Expand Down
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ brew install zabbix-cli

### Binary

Binaries built with PyInstaller can be found on the [releases page](https://github.com/unioslo/zabbix-cli/releases). We build binaries for Linux (x86), macOS (ARM) and Windows (x86) for each release.
Binaries built with PyInstaller can be found on the [releases page](https://github.com/unioslo/zabbix-cli/releases). We build binaries for Linux (x86), macOS (ARM & x86) and Windows (x86) for each release.

## Quick start

Expand All @@ -96,42 +96,53 @@ Zabbix-cli is a command line interface for Zabbix. It can be used in three ways:
2. **Single command**: Run a single command by running `zabbix-cli COMMAND`. This will run the command and print the output.
3. **Batch mode**: Run multiple commands from a file by running `zabbix-cli -f FILE`. The file should contain one command per line.

Command reference can be found in the [online user guide](https://unioslo.github.io/zabbix-cli/guide/introduction/) or by running `zabbix-cli --help`.
Command reference can be found in the [online user guide](https://unioslo.github.io/zabbix-cli/guide/commands/) or by running `zabbix-cli --help`.

### Authentication

By default, the application will prompt for a username and password. Once authenticated, the application stores the session token in a file for future use.

For more information about the various authentication methods, see the [authentication guide](https://unioslo.github.io/zabbix-cli/guide/authentication/).

## Formats
### Configuration

Zabbix-cli needs a config file. It is created when the application is started for the first time. The config file can be created manually with the `init` command:

```bash
zabbix-cli init --zabbix-url https://zabbix.example.com/
```

For more detailed information about the configuration file, see the [configuration guide](https://unioslo.github.io/zabbix-cli/guide/configuration/).

### Formats

Zabbix-cli supports two output formats: table and JSON. The default format is table, but it can be changed with the `--format` parameter:

```bash
# Show hosts in table format (default)
zabbix-cli show_hosts

# Show hosts in JSON format
zabbix-cli --format json show_hosts

# Setting format in REPL
# Set format in REPL mode
> --format json show_hosts
```

Or by setting the `app.output.format` option in the config file:
The default format can be configured with the `app.output.format` config option:

```toml
[app.output]
format = "json"
```

### Table
#### Table

<img width="60%" alt="format-table" src="https://github.com/user-attachments/assets/207fa12b-39c6-45b9-9f0e-7f217c723461">

The default rendering mode is a [Rich](https://github.com/Textualize/rich) table that adapts to the width of the terminal.

### JSON
#### JSON

<img width="60%" alt="format-json" src="https://github.com/user-attachments/assets/680f507b-dc2a-41b2-87c4-c3a443d83979">

Expand All @@ -148,16 +159,6 @@ The JSON output format is always in this format, where `ResultT` is the expected

The type of the `result` field varies based on the command run. For `show_host` it is a single Host object, while for `show_hosts` it is an _array_ of Host objects.

## Configuration

Zabbix-cli needs a config file. It is created when the application is started for the first time. The config file can be created manually with the `init` command:

```bash
zabbix-cli init --zabbix-url https://zabbix.example.com/
```

For more information about the configuration file, see the [configuration guide](https://unioslo.github.io/zabbix-cli/guide/configuration/).

## Development

Zabbix-cli currently uses [Hatch](https://hatch.pypa.io/latest/) for project management and packaging. To start off, clone the repository:
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/commands/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Commands

Each command and its arguments and/or options are documented in the following pages. The commands are grouped by category.

<!-- TODO: add list of categories here -->

0 comments on commit 65fd635

Please sign in to comment.