celestial_pointing/commands/
use_term.rs1use super::{Command, CommandOutput};
2use crate::error::Result;
3use crate::session::Session;
4
5pub struct Use;
6
7impl Command for Use {
8 fn name(&self) -> &str {
9 "USE"
10 }
11 fn description(&self) -> &str {
12 "Add term(s) to model"
13 }
14
15 fn execute(&self, session: &mut Session, args: &[&str]) -> Result<CommandOutput> {
16 if args.is_empty() {
17 return Err(crate::error::Error::Parse(
18 "USE requires term name(s)".into(),
19 ));
20 }
21 let mut added = Vec::new();
22 for name in args {
23 session.model.add_term(name)?;
24 added.push(name.to_uppercase());
25 }
26 Ok(CommandOutput::Text(format!("Added: {}", added.join(", "))))
27 }
28}