Skip to content

Add missing CLI commands for TTL, transactions, indexes, and value search #398

Description

@ElioNeto

Problem

The CLI (src/cli/mod.rs) has 14 subcommands but is missing support for features recently added to the REST API and engine:

Feature REST API CLI?
TTL GET/PATCH /keys/{key}/ttl
Transactions POST /txn + /commit /rollback
Secondary Indexes POST /keys/{key}/index/{field}, GET /keys/by-index
Value Search GET /keys/value-search
Key Search Modes GET /keys/search?mode=contains|regex
Batch Delete POST /keys/batch/delete
Prefix Delete DELETE /keys?prefix=
Notes CRUD Via API only

Request

Add the following CLI subcommands:

TTL

  • ttl set <key> <ttl_secs> — set or update TTL on existing key (calls PATCH /keys/{key}/ttl)
  • ttl get <key> — get remaining TTL (calls GET /keys/{key}/ttl)
  • set <key> <value> [--ttl <secs>] — extend existing set command with optional --ttl flag

Transactions

  • txn begin — begin transaction, prints txn_id
  • txn put <txn_id> <key> <value> — stage write
  • txn delete <txn_id> <key> — stage delete
  • txn commit <txn_id> — commit
  • txn rollback <txn_id> — rollback

Indexes

  • index create <field> — create secondary index on JSON field
  • index query <field> <value> — query by index
  • index list — list all indexes

Search

  • search <query> [--mode prefix|contains|regex] [--limit N] — extend existing search with mode flag
  • value-search <query> — search by value content

Batch/Prefix operations

  • batch-delete <key1> [<key2> ...] — delete specific keys
  • delete-prefix <prefix> — delete all keys matching prefix

Acceptance criteria

  • Each new subcommand is tested via assert_cmd or similar CLI test framework
  • Commands that call REST use reqwest (already a dependency) or call engine directly
  • Help text (--help) is comprehensive and consistent
  • Error messages are user-friendly
  • Version string shown in CLI matches package version
  • Use clap (already a dependency) for argument parsing

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions