Skip to content

fix(cli): validate sort_by and sort_order on list-entries and timeline (#1387) - #1674

Open
prateeknitcse wants to merge 1 commit into
pyrite-wiki:devfrom
prateeknitcse:fix/1387-cli-sort-options-validation
Open

prateeknitcse wants to merge 1 commit into
pyrite-wiki:devfrom
prateeknitcse:fix/1387-cli-sort-options-validation

Conversation

@prateeknitcse

Copy link
Copy Markdown
Contributor

Closes #1387.

Summary of Changes

  • In pyrite/cli/browse_commands.py:
    • Added validate_sort_by callback ensuring --sort-by on list-entries is one of title, updated_at, created_at, entry_type.
    • Added validate_sort_order callback ensuring --sort-order on list-entries and --sort on timeline is one of asc, desc.
    • Invalid values are refused before queries run with exit code 2 (USAGE_ERROR), naming the option and allowed values.
  • Added regression tests in tests/test_cli_sort_values.py covering invalid values, empty strings, case insensitivity, and valid sorting behavior.
  • Added changelog fragment changelog.d/1387-cli-sort-options-validation.fixed.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

timeline --sort and list-entries --sort-order/--sort-by accept any value and silently pick a different default each

1 participant