use super::*;
#[derive(Debug, clap::Args)]
pub struct CommandLs {
}
impl CommandLs {
pub fn process<T: AsMut<S>, S: ToolState, W: Write>(
&self,
mut tool_state: T,
out: &mut W,
) -> Result<(), Error> {
let tool_state = tool_state.as_mut();
let keypath = tool_state.get_keypath()?;
let key_map = tool_state.key_map_mut();
if let Some(key_map) = key_map.get_key_map(keypath) {
for child in key_map.get_children() {
write!(out, "{} \t[", child)?;
for primitive in key_map.get_child(child).unwrap().get_primitives() {
write!(out, " {}", primitive)?;
}
writeln!(out, " ]")?;
}
}
Ok(())
}
}