From 4b7569b844bf2e7541f9b2cb25561ce7b9bbfa38 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 19 Aug 2025 14:57:30 -0600 Subject: [PATCH] make scan/s/r/review aliases for edit subcommand --- src/main.rs | 2 +- tests/integration_tests.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fab4ebf..37c30b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,7 +71,7 @@ enum Commands { refs: Vec, }, /// Edit items in your $EDITOR - #[command(alias = "e")] + #[command(aliases = ["e", "s", "scan", "r", "review"])] Edit, } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index b5e5ec6..1925081 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -641,6 +641,28 @@ mod edit_functionality { assert!(todos.contains("# TODOs")); assert!(todos.contains("## Default")); } + + #[test] + fn test_edit_aliases() { + let env = TestEnv::new(); + + // Test all aliases work by using echo to verify they're called + let aliases = vec!["edit", "e", "scan", "s", "review", "r"]; + + for alias in aliases { + let result = Command::new(&env.binary_path) + .args(&[alias]) + .env("XDG_DATA_HOME", &env.data_dir) + .env("EDITOR", "/bin/echo") + .output() + .expect(&format!("Failed to execute {} command", alias)); + + // Should succeed and echo the file path + assert_eq!(result.status.code().unwrap_or(-1), 0); + let stdout = String::from_utf8_lossy(&result.stdout); + assert!(stdout.contains("todos.md"), "Alias '{}' didn't work: {}", alias, stdout); + } + } } #[cfg(test)]