MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / Command

Interface Command

atomic-cli/src/commands/mod.rs:214–229  ·  view source on GitHub ↗

Trait that all CLI commands must implement. This trait provides a uniform interface for executing commands, enabling consistent error handling and testing across all commands. # Implementing Commands Each command should: 1. Parse and validate its arguments in the struct fields 2. Implement `run()` to perform the actual operation 3. Return appropriate errors using [`CliError`] # Example ```rus

Source from the content-addressed store, hash-verified

212/// }
213/// ```
214pub trait Command {
215 /// Execute the command.
216 ///
217 /// This method performs the main logic of the command. It should:
218 /// - Validate any preconditions
219 /// - Perform the requested operation
220 /// - Print appropriate output to the user
221 /// - Return errors using [`CliError`] for consistent error handling
222 ///
223 /// # Errors
224 ///
225 /// Returns a [`CliError`] if the command fails for any reason.
226 /// The error should be as specific as possible to help users
227 /// understand what went wrong and how to fix it.
228 fn run(&self) -> CliResult<()>;
229}
230
231// Repository Discovery
232

Callers

nothing calls this directly

Implementers 15

sandbox.rsatomic-cli/src/commands/sandbox.rs
split.rsatomic-cli/src/commands/split.rs
stash.rsatomic-cli/src/commands/stash.rs
remove.rsatomic-cli/src/commands/remove.rs
add.rsatomic-cli/src/commands/add.rs
doctor.rsatomic-cli/src/commands/doctor.rs
session.rsatomic-cli/src/commands/session.rs
update.rsatomic-cli/src/commands/update.rs
status.rsatomic-cli/src/commands/status.rs
mv.rsatomic-cli/src/commands/mv.rs
init.rsatomic-cli/src/commands/init.rs
insert.rsatomic-cli/src/commands/insert.rs

Calls

no outgoing calls

Tested by

no test coverage detected