Skip to main content

talon_cli/cli/
scope.rs

1//! Shared `--scope` / `--scope-only` / `--scope-all` flags for query commands.
2
3use clap::Args;
4
5/// Scope-selection flags shared across query commands.
6///
7/// - `scope` (additive): named scope appended to the default search pool.
8/// - `scope_only` (exclusive): search only the named scope(s).
9/// - `scope_all`: search every configured scope, overriding `default = false`.
10///
11/// Mutual exclusivity (`scope` ⊕ `scope_only` ⊕ `scope_all`) is enforced by
12/// [`talon_core::ScopeFilter::from_args`] when each command builds its filter.
13#[derive(Debug, Clone, Default, Args)]
14#[command(next_help_heading = "SCOPE")]
15pub struct SharedScopeArgs {
16    /// Add a configured scope to the default search pool (repeatable).
17    /// Required to include scopes with `default = false`.
18    #[arg(short, long)]
19    pub scope: Vec<String>,
20
21    /// Search only the named scope (repeatable; mutually exclusive
22    /// with --scope and --scope-all).
23    #[arg(long)]
24    pub scope_only: Vec<String>,
25
26    /// Search every configured scope, overriding `default = false`.
27    #[arg(long)]
28    pub scope_all: bool,
29}