Metadata-Version: 2.4
Name: studium-cli
Version: 0.2.2
Summary: CLI tool for Uppsala University Canvas (Studium)
Author-email: Markus Bajlo <markus@bajlo.se>
Requires-Python: >=3.12
Requires-Dist: notify-py>=0.3.43
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: questionary>=2.0.1
Requires-Dist: requests>=2.31.0
Requires-Dist: rich>=14.0.0
Requires-Dist: typer>=0.24.0
Description-Content-Type: text/markdown

# Studium CLI

A command-line tool for Uppsala University's Canvas instance (Studium).

## Installation

### 1. Install UV

UV is required to run and install this tool. See the [UV documentation](https://github.com/astral-sh/uv).

```bash
curl -sSfL https://astral-sh.uv.io/install.sh | sh
```

### 2. Install the CLI

You can install it directly from the source:

```bash
git clone https://github.com/mackrus/studium.git
cd studium
uv tool install .
```

## Setup

You will need an API Access Token from Studium:
1. Log in to [Studium](https://uppsala.instructure.com).
2. Go to **Account** > **Settings**.
3. Scroll to **Approved Integrations** and click **+ New Access Token**.
4. Copy the token and set it in the CLI:

```bash
studium config set-token <YOUR_TOKEN>
```
*(Configuration is stored in `~/.config/studium/.env`)*

## Usage

Check your connection:
```bash
studium config status
```

List your active courses:
```bash
studium courses
```

List upcoming assignments:
```bash
# Display a table with countdown timers
studium assignments

# Filter by course code
studium assignments --course 1FA603

# Force a refresh from the API and update the cache
studium assignments --force

# Get a status-bar-formatted string (󰑫 3)
studium assignments --format sketchybar
```

List recent announcements:
```bash
studium announcements
```

Update to the latest version:
```bash
studium update
```

Open in browser:
```bash
# Open the assignment with the closest deadline
studium browser latest

# Open a specific course or assignment by ID
studium browser 123456
```

Sync with Canvas (updates cache and sends macOS/Linux notifications):

```bash
studium sync
```
*(Local cache is stored at `~/.cache/studium/assignments.json`)*

### Shell Completions

#### Bash, Zsh, Fish, PowerShell
The CLI uses Typer, which supports automatic completion installation:
```bash
studium --install-completion
```

#### Nushell
Completions for Nushell are provided in [`contrib/completions/studium.nu`](contrib/completions/studium.nu).
Add this to your `config.nu`:
```nushell
source /path/to/studium/contrib/completions/studium.nu
```

## Extensions

### Sketchybar (macOS)
Scripts and setup instructions for integration with Sketchybar are available in the [`contrib/sketchybar/`](contrib/sketchybar/) directory.

### Linux Status Bars (Polybar, Waybar, etc.)
The `studium assignments --format sketchybar` command outputs a simple string (e.g., `󰑫 3`) that can be used in most Linux status bars.

#### Polybar (X11)
Add a custom module to your `config.ini`:
```ini
[module/studium]
type = custom/script
exec = studium assignments --format sketchybar
interval = 600
label = %output%
```

#### Waybar (Wayland)
Add a custom module to your `config.jsonc`:
```json
"custom/studium": {
    "format": "{}",
    "interval": 600,
    "exec": "studium assignments --format sketchybar"
}
```

## Development

To run the tool locally without installing:
```bash
uv run studium <command>
```
\n- Auto-versioning enabled via git hook.
