make scan/s/r/review aliases for edit subcommand

This commit is contained in:
swaits committed 2025-08-19 15:01:26 -06:00
1 parent 8b736c1d22
commit 4b7569b844
2 files changed
+23 -1

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@ enum Commands {
refs: Vec<String>, refs: Vec<String>,
}, },
/// Edit items in your $EDITOR /// Edit items in your $EDITOR
#[command(alias = "e")] #[command(aliases = ["e", "s", "scan", "r", "review"])]
Edit, Edit,
} }
+22
View File
@@ -641,6 +641,28 @@ mod edit_functionality {
assert!(todos.contains("# TODOs")); assert!(todos.contains("# TODOs"));
assert!(todos.contains("## Default")); 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)] #[cfg(test)]