1use anyhow::Result;
2
3use crate::cli::parse_distance;
4use crate::commands::Run;
5
6#[derive(Debug, clap::Args)]
8pub struct Down {
9 #[arg(value_name = "COUNT", value_parser = parse_distance, allow_negative_numbers = true)]
11 count: Option<usize>,
12 #[arg(long)]
16 from_path: bool,
17}
18
19impl Run for Down {
20 fn run(self) -> Result<()> {
21 crate::stack::checkout_parent(self.count.unwrap_or(1), self.nav_output())
22 }
23}
24
25impl Down {
26 fn nav_output(&self) -> crate::stack::NavOutput {
27 if self.from_path {
28 crate::stack::NavOutput::Path
29 } else {
30 crate::stack::NavOutput::Announce
31 }
32 }
33}