Skip to content

feat: add -q/--query and -l/--limit flags to list-collectors#17

Merged
patrick204nqh merged 1 commit into
mainfrom
feat/list-collectors-filtering
Feb 11, 2026
Merged

feat: add -q/--query and -l/--limit flags to list-collectors#17
patrick204nqh merged 1 commit into
mainfrom
feat/list-collectors-filtering

Conversation

@patrick204nqh
Copy link
Copy Markdown
Owner

Summary

  • Add -q/--query flag to filter collectors by name or category (case-insensitive substring match)
  • Add -l/--limit flag to cap the number of returned collectors
  • Consistent with the existing list-monitors interface

Details

The Sumo Logic /collectors API doesn't support server-side filtering, so filtering is applied client-side after fetching all collectors. The query matches against both name and category fields. Limit is applied after filtering.

Files changed:

  • lib/sumologic/cli.rb — Thor option declarations and updated help text
  • lib/sumologic/cli/commands/list_collectors_command.rb — Pass query/limit to client
  • lib/sumologic/metadata/collector.rb — Client-side filter and limit logic
  • lib/sumologic/client.rb — Updated facade signature
  • spec/sumologic/metadata/collector_spec.rb — New: 8 tests for filtering/limiting
  • spec/sumologic/cli/commands/commands_spec.rb — Updated command test

Test plan

  • 8 new metadata tests: filter by name, category, case-insensitive, limit, query+limit combo, empty response, error handling
  • Updated command spec verifies query/limit passthrough
  • Full suite: 166/166 passing

Closes #11

The collectors API returns all collectors with no server-side filtering.
Add client-side filtering by name or category (case-insensitive substring
match) and an optional limit, consistent with the list-monitors interface.

Closes #11.
@patrick204nqh patrick204nqh merged commit c992f00 into main Feb 11, 2026
2 checks passed
@patrick204nqh patrick204nqh deleted the feat/list-collectors-filtering branch February 11, 2026 08:31
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.

Add -q/--query and -l/--limit flags to list-collectors

1 participant