Skip to content

Using the CLI

Benjamin Demetz edited this page Jun 13, 2025 · 3 revisions

Tooka's CLI is designed to be simple and intuitive. Here’s an overview of available commands and how to use them in your workflow.


🧾 Command List

Command Description
add <YAML-file> Import a rule file
remove <ID> Remove a rule by its ID
toggle <ID> Enable or disable a rule
list List all loaded rules
export <ID> <path> Export a rule to a YAML file
sort [OPTIONS] Apply active rules to files in a folder
template [OPTIONS] Generate rule templates using predefined patterns
config [OPTIONS] View or update Tooka’s configuration
completions <shell> Generate autocompletion scripts for bash, zsh, fish, etc.

⚙️ Typical Workflow

  1. Add rules:

    tooka add my-rules.yaml
  2. View all rules:

    tooka list
  3. Toggle specific rules (optional):

    tooka toggle example_rule
  4. Dry-run your folder:

    tooka sort --dry-run ~/Downloads
  5. Generate a detailed report:

    tooka sort --report=pdf

Tip

Rules are enabled by default after adding. Toggling is optional unless you want to temporarily disable one.

You can also temporarily override the configuration when sorting:

tooka sort \
  --source=<folder> \
  --rules=<comma-separated-rule-ids> \
  --report=<pdf|csv|json> \
  --output=<report-output-folder>

📦 Rule Management

  • Add a rule:

    tooka add my-rule.yaml
  • List current rules:

    tooka list
  • Remove a rule by ID:

    tooka remove example_rule
  • Toggle a rule (enable/disable):

     tooka toggle example_rule

Important

Rule IDs must be unique. Use --overwrite to replace an existing rule: tooka add my-rule.yaml --overwrite

🧠 Autocompletions

Tooka supports generating autocompletions for various shells:

tooka completions bash

Paste the result into your shell’s configuration file (e.g. ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish).

🌍 Environment Variables

You can override Tooka’s default paths using environment variables:

Variable Purpose
TOOKA_CONFIG_DIR Path to config file
TOOKA_DATA_DIR Path to data directory (rules, logs, etc.)
TOOKA_SOURCE_FOLDER Default folder to scan with the sort command

Example

export TOOKA_CONFIG_DIR="$HOME/.config/custom-tooka"
export TOOKA_DATA_DIR="$HOME/.local/share/custom-tooka"
export TOOKA_SOURCE_FOLDER="$HOME/Downloads"

Set these in your .bashrc, .zshrc, or equivalent to persist them across sessions.

Clone this wiki locally