Skip to content

fix(history): harden --days missing-value like cost --days #122

@CoreyRDean

Description

@CoreyRDean

Follow-up from PR #103 author's known-limitations list.

Problem

PR #103 hardened `clauck cost --days` (and `--last`) to die with a clear error when the flag is provided without a following integer value. The same treatment was not applied to `clauck history --days`.

Currently: `clauck history --days` (no value) silently removes the flag and falls back to the default window. Inconsistent with the sibling command, and hides user input errors.

Fix

Mirror the guard from `cmd_cost`'s `--days` parsing into `cmd_history`. One-liner:

```python
if args[i] == "--days":
if i + 1 >= len(args) or not args[i+1].lstrip('-').isdigit():
die("--days requires an integer")
```

Acceptance

  • `clauck history --days` (no value) exits non-zero with a clear error.
  • `clauck history --days abc` exits non-zero with the same error.
  • `clauck history --days 7` works as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions