A file-based task manager
0
fork

Configure Feed

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

Clean up lint warnings

- Move CLI logic into src/lib.rs as `pub fn run() -> i32` so the tsk and
git-tsk binaries can each be a tiny shim under src/bin/, dropping
Cargo's "source file present in multiple build targets" warning.
- Delete unused Error::NotSelected variant.
- Delete unused properties::replace_all helper.

cargo build is now warning-free; cargo test still 61 passing.

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

+20 -25
+5 -6
Cargo.toml
··· 10 10 readme = "readme" 11 11 authors = ["Noah Pederson <noah@packetlost.dev>"] 12 12 13 - [[bin]] 14 - name = "tsk" 15 - path = "src/main.rs" 13 + [lib] 14 + name = "tsk_cli" 15 + path = "src/lib.rs" 16 16 17 - [[bin]] 18 - name = "git-tsk" 19 - path = "src/main.rs" 17 + # Both bins are thin shims around `tsk_cli::run`. Cargo auto-discovers them 18 + # from `src/bin/`, so no explicit [[bin]] entries are needed. 20 19 21 20 [dependencies] 22 21 clap = { version = "4", features = ["derive", "env"] }
+3
src/bin/git-tsk.rs
··· 1 + fn main() { 2 + std::process::exit(tsk_cli::run()); 3 + }
+3
src/bin/tsk.rs
··· 1 + fn main() { 2 + std::process::exit(tsk_cli::run()); 3 + }
-2
src/errors.rs
··· 22 22 FromUtf8(#[from] FromUtf8Error), 23 23 #[error("No tasks on stack")] 24 24 NoTasks, 25 - #[error("No task selected.")] 26 - NotSelected, 27 25 #[allow(dead_code)] 28 26 #[error("An unexpected error occurred: {0}")] 29 27 Oops(Box<dyn std::error::Error>),
+9 -6
src/main.rs src/lib.rs
··· 1 - mod errors; 1 + pub mod errors; 2 2 mod fzf; 3 3 mod namespace; 4 4 mod object; ··· 278 278 .unwrap_or_else(|| Some("origin".to_string())) 279 279 } 280 280 281 - fn run(cli: Cli) -> Result<()> { 281 + fn dispatch(cli: Cli) -> Result<()> { 282 282 let dir = match cli.dir { 283 283 Some(d) => d, 284 284 None => default_dir()?, ··· 341 341 } 342 342 } 343 343 344 - fn main() { 345 - match run(Cli::parse()) { 346 - Ok(()) => exit(0), 344 + /// Parse the CLI from `std::env::args()` and execute. Returns the process 345 + /// exit code so callers (the `tsk` and `git-tsk` bins) can hand it to 346 + /// `std::process::exit`. 347 + pub fn run() -> i32 { 348 + match dispatch(Cli::parse()) { 349 + Ok(()) => 0, 347 350 Err(e) => { 348 351 eprintln!("{e}"); 349 - exit(2); 352 + 2 350 353 } 351 354 } 352 355 }
-11
src/properties.rs
··· 108 108 write_index(repo, key, &entries, message) 109 109 } 110 110 111 - /// Replace the entire index for `key` with the given map. Useful when a 112 - /// task is fully rewritten and we sync many keys at once. 113 - pub fn replace_all( 114 - repo: &Repository, 115 - key: &str, 116 - entries: &BTreeMap<StableId, Vec<String>>, 117 - message: &str, 118 - ) -> Result<()> { 119 - write_index(repo, key, entries, message) 120 - } 121 - 122 111 /// Every property key currently indexed in this repo. 123 112 pub fn list_keys(repo: &Repository) -> Result<Vec<String>> { 124 113 let mut out = Vec::new();