MCPcopy Index your code
hub / github.com/atomicdotdev/atomic / Command

Interface Command

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

197/// }
198/// ```
199pub trait Command {
200 /// Execute the command.
201 ///
202 /// This method performs the main logic of the command. It should:
203 /// - Validate any preconditions
204 /// - Perform the requested operation
205 /// - Print appropriate output to the user
206 /// - Return errors using [`CliError`] for consistent error handling
207 ///
208 /// # Errors
209 ///
210 /// Returns a [`CliError`] if the command fails for any reason.
211 /// The error should be as specific as possible to help users
212 /// understand what went wrong and how to fix it.
213 fn run(&self) -> CliResult<()>;
214}
215
216// Repository Discovery
217

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
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
unrecord.rsatomic-cli/src/commands/unrecord.rs

Calls

no outgoing calls

Tested by

no test coverage detected