1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Port of `_command` from `Completion/Zsh/Command/_command`.
//!
//! Full upstream body (7 lines verbatim):
//! ```text
//! sh:1 #compdef command
//! sh:2
//! sh:3 _arguments \
//! sh:4 '-v[indicate result of command search]:*:command:_path_commands' \
//! sh:5 '-V[show result of command search in verbose form]:*:command:_path_commands' \
//! sh:6 '(-)-p[use default PATH to find command]' \
//! sh:7 '*:: : _normal -p $service'
//! ```
use crate::ported::exec_hooks::dispatch_function_call;
/// `_command` — `command` builtin completion: pure `_arguments`
/// dispatch (sibling shell fn). Returns 1 without an executor.
pub fn _command() -> i32 {
dispatch_function_call(
"_arguments",
&[
"-v[indicate result of command search]:*:command:_path_commands".to_string(),
"-V[show result of command search in verbose form]:*:command:_path_commands"
.to_string(),
"(-)-p[use default PATH to find command]".to_string(),
"*:: : _normal -p $service".to_string(),
],
)
.unwrap_or(1)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn returns_one_without_executor() {
let _g = crate::test_util::global_state_lock();
assert_eq!(_command(), 1);
}
}