Metadata-Version: 2.3
Name: zebrastream-cli
Version: 0.0.1
Summary: An open-source CLI for managing ZebraStream accounts.
License: GPL-3.0-or-later
Author: Johannes Dröge
Author-email: p5p129dw@parsimonit.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: attrs (>=22.2.0)
Requires-Dist: click (>=8.1.7)
Requires-Dist: confuse (>=2.0.1,<3.0.0)
Requires-Dist: httpx (>=0.23.0,<0.29.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Requires-Dist: rich (>=13.0.0,<14.0.0)
Requires-Dist: typer[all] (>=0.16.0,<0.17.0)
Description-Content-Type: text/markdown

# ZebraStream CLI

An open-source command-line interface for the Management API of [ZebraStream](https://www.zebrastream.io), a simple, managed service to establish data flow between organizations, applications, and devices. Easily manage access tokens and view usage statistics for your ZebraStream account from your terminal.

## Features
- Create new access tokens
- List all access tokens
- Delete access tokens
- Show usage statistics

## Installation

### Recommended: Install Globally with pipx
[pipx](https://pypa.github.io/pipx/) allows you to run Python CLI tools in isolated environments:

```bash
pipx install zebrastream-cli
```

### Install the Latest Stable Release from PyPI
```bash
pip install zebrastream-cli
```

### Install the Latest Development Version from GitHub
```bash
pip install git+https://github.com/ZebraStream/zebrastream-cli.git
```

## Usage

After installation, the CLI is available as `zebrastream-cli`:

### Authentication
All commands require an API key. You can set it as an environment variable:

```bash
export ZEBRASTREAM_API_KEY=your_api_key_here
```

You can also set the API key persistently:
```bash
ZEBRASTREAM_API_KEY=your_api_key_here zebrastream-cli persist-config
```

### Optional: Custom API URL
The default uses the official ZebraStream Management API, but it is also possible to use a custom ZebraStream API endpoint:

```bash
export ZEBRASTREAM_API_URL=https://your.custom.api.url
```

### Commands

#### Create a New Access Token
```bash
zebrastream-cli create-token \
  --path /mystream \
  --access-mode read \
  --expires 2027-12-31 \
  [--recursive]
```
- `--expires` accepts ISO 8601 format (e.g. `2027-12-31` or `2027-12-31T12:34:56`).

#### List All Access Tokens
```bash
zebrastream-cli list-tokens
```
- Expired tokens are highlighted in red.

#### Delete an Access Token
```bash
zebrastream-cli delete-token --token-id key_xxxxxxxxxxxxxxxx
```

#### Show Usage Statistics
```bash
zebrastream-cli show-usage [--month YYYY-MM]
```



## Help
To see the available commands use:
```bash
zebrastream-cli --help
```

For detailed help on any command, use:
```bash
zebrastream-cli COMMAND --help
```

## License
See [LICENSE](LICENSE) for details.

