Skip to main content

celestial_pointing/commands/
reset.rs

1use super::{Command, CommandOutput};
2use crate::error::Result;
3use crate::session::Session;
4
5pub struct Reset;
6
7impl Command for Reset {
8    fn name(&self) -> &str {
9        "RESET"
10    }
11    fn description(&self) -> &str {
12        "Zero all coefficients"
13    }
14
15    fn execute(&self, session: &mut Session, _args: &[&str]) -> Result<CommandOutput> {
16        session.model.zero_coefficients();
17        session.last_fit = None;
18        let count = session.model.term_count();
19        Ok(CommandOutput::Text(format!(
20            "Reset {} coefficients to zero",
21            count
22        )))
23    }
24}