Skip to content

feat: Add support for --filter and --tag arguments for services in cli #190

@nick4eva

Description

@nick4eva

Summary

Add CLI flags to apply a fuzzy filter and/or tag selector at startup, so claws can launch directly into a pre-filtered resource list — mirroring the existing in-TUI / and :tag commands.

Motivation

When working with a known subset of resources in a large account (e.g., a handful of EC2 bastion hosts among hundreds of instances), reaching them currently takes multiple steps:

  1. claws -p prod -r us-west-2 -s ec2
  2. Wait for the full list to load
  3. Press / and type the filter, or :tag Role=bastion

Both filters already exist inside the TUI. Surfacing them as CLI flags would let users wrap common workflows in shell aliases and get from terminal to selecting the right instance in zero extra keystrokes. A concrete example: aliasing a one-shot command that lands on the prod bastion list, ready for a → SSM Session Manager.

Proposed solution

Two new flags, named after the existing in-TUI commands:

# Fuzzy filter (equivalent to pressing `/bastion<Enter>` after launch)
claws -s ec2 -f bastion
claws -s ec2 --filter bastion

# Tag filter (equivalent to `:tag Role=bastion`)
claws -s ec2 --tag Role=bastion

# Repeatable for multiple tags
claws -s ec2 --tag Env=prod --tag Role=bastion

Ideally also settable under startup: in config.yaml for persistence, matching how view, profiles, and regions already work:

startup:
  view: ec2
  filter: bastion
  tags:
    - Role=bastion
    - Env=prod

Alternatives considered

  • Shell alias + manual keystrokes — works today for /, but still requires typing the filter by hand after launch, and doesn't compose with tag filters (which need command mode :).
  • Piping into stdin — not viable for a Bubbletea TUI.

Additional context

This would compose well with the existing -p / -r / -s flags and unlock single-command workflows like:

alias prod-bastions='claws -p prod -r us-west-2 -s ec2 --tag Role=bastion'

From there it's a → SSM Session Manager and you're in. Happy to take a stab at a PR if the direction sounds right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions