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

Interface Command

atomic-cli/src/commands/mod.rs:230–245  ·  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

228/// }
229/// ```
230pub trait Command {
231 /// Execute the command.
232 ///
233 /// This method performs the main logic of the command. It should:
234 /// - Validate any preconditions
235 /// - Perform the requested operation
236 /// - Print appropriate output to the user
237 /// - Return errors using [`CliError`] for consistent error handling
238 ///
239 /// # Errors
240 ///
241 /// Returns a [`CliError`] if the command fails for any reason.
242 /// The error should be as specific as possible to help users
243 /// understand what went wrong and how to fix it.
244 fn run(&self) -> CliResult<()>;
245}
246
247// Repository Discovery
248

Callers

nothing calls this directly

Implementers 15

compact.rsatomic-cli/src/commands/compact.rs
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
blame.rsatomic-cli/src/commands/blame.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
repo.rsatomic-cli/src/commands/repo.rs

Calls

no outgoing calls

Tested by

no test coverage detected