A file-based task manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Global -q/--queue flag to override the active queue per-invocation

Add a top-level `-q <queue>` / `--queue <queue>` flag (clap `global =
true`) that overrides the per-clone active queue selector for the
duration of one command. Affects every command that reads or writes
the active queue — push/drop/list/swap/rot/tor/prioritize/inbox/
assign/accept/reject/export/queue current/etc. — without changing
the on-disk selector.

Implementation is one process-wide `OnceLock<Option<String>>` set by
`dispatch` from `cli.queue`; `Workspace::queue()` consults it before
reading `<git-dir>/tsk/queue`. No per-command plumbing.

Smoke-tested: `tsk -q tsk queue current` → `tsk`; with active queue
`claude`, `tsk list` lists claude tasks while `tsk -q tsk list` shows
the empty tsk queue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+20
+7
src/lib.rs
··· 35 35 /// Override the tsk root directory. 36 36 #[arg(short = 'C', env = "TSK_ROOT", value_name = "DIR")] 37 37 dir: Option<PathBuf>, 38 + /// Override the active queue for this invocation only. Affects every 39 + /// command that reads/writes the active queue (push, drop, swap, 40 + /// rot/tor, prioritize/deprioritize, list, inbox, assign, accept, 41 + /// reject, export, ...). 42 + #[arg(short = 'q', long = "queue", value_name = "QUEUE", global = true)] 43 + queue: Option<String>, 38 44 #[command(subcommand)] 39 45 command: Commands, 40 46 } ··· 385 391 } 386 392 387 393 fn dispatch(cli: Cli) -> Result<()> { 394 + workspace::set_queue_override(cli.queue); 388 395 let dir = match cli.dir { 389 396 Some(d) => d, 390 397 None => default_dir()?,
+13
src/workspace.rs
··· 14 14 use std::fmt::Display; 15 15 use std::path::PathBuf; 16 16 use std::str::FromStr; 17 + use std::sync::OnceLock; 18 + 19 + /// Process-wide override for the active queue, set once by the CLI's 20 + /// `-q/--queue` flag. When `Some`, `Workspace::queue()` returns this 21 + /// value instead of reading `<git-dir>/tsk/queue`. 22 + static QUEUE_OVERRIDE: OnceLock<Option<String>> = OnceLock::new(); 23 + 24 + pub fn set_queue_override(q: Option<String>) { 25 + let _ = QUEUE_OVERRIDE.set(q); 26 + } 17 27 18 28 #[derive(Debug)] 19 29 pub struct ImportOutcome { ··· 178 188 } 179 189 180 190 pub fn queue(&self) -> String { 191 + if let Some(Some(q)) = QUEUE_OVERRIDE.get() { 192 + return q.clone(); 193 + } 181 194 self.read_selector(QUEUE_FILE, queue::DEFAULT_QUEUE) 182 195 } 183 196