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

Method suggestion

atomic-cli/src/error.rs:485–553  ·  view source on GitHub ↗

Get a suggestion for how to resolve this error. Returns a human-readable suggestion that can help users understand what action to take to resolve the error. # Returns An optional string with a suggestion, or `None` if no specific suggestion is available. # Example ```rust,ignore let err = CliError::repository_not_found("/home/user/project"); if let Some(suggestion) = err.suggestion() { eprint

(&self)

Source from the content-addressed store, hash-verified

483 /// }
484 /// ```
485 pub fn suggestion(&self) -> Option<&'static str> {
486 match self {
487 Self::RepositoryNotFound { .. } => {
488 Some("Run 'atomic init' to create a new repository, or change to a directory inside an existing repository.")
489 }
490 Self::RepositoryExists { .. } => {
491 Some("The directory is already an Atomic repository. Use 'atomic status' to see its state.")
492 }
493 Self::ViewNotFound { .. } => {
494 Some("Run 'atomic view list' to see available views, or 'atomic view create <name>' to create a new one.")
495 }
496 Self::ViewAlreadyExists { .. } => {
497 Some("Choose a different name, or use 'atomic view switch <name>' to switch to the existing view.")
498 }
499 Self::CannotDeleteCurrentView { .. } => {
500 Some("Switch to a different view first with 'atomic view switch <name>', then delete this one.")
501 }
502 Self::FileNotFound { .. } => {
503 Some("Check that the file path is correct. Use 'ls' or your file manager to verify the file exists.")
504 }
505 Self::FileNotTracked { .. } => {
506 Some("Run 'atomic add <file>' to start tracking this file.")
507 }
508 Self::FileAlreadyTracked { .. } => {
509 Some("This file is already tracked. Use 'atomic status' to see its current state.")
510 }
511 Self::PathOutsideRepository { .. } => {
512 Some("Atomic can only track files within the repository. Move the file inside the repository or initialize a new repository in its parent directory.")
513 }
514 Self::NothingToRecord => {
515 Some("Make some changes to tracked files, or use 'atomic add' to track new files.")
516 }
517 Self::ChangeNotFound { .. } => {
518 Some("Run 'atomic log' to see available changes and their hashes.")
519 }
520 Self::AmbiguousHash { .. } => {
521 Some("Provide more characters of the hash to uniquely identify the change.")
522 }
523 Self::MissingDependency { .. } => {
524 Some("Insert the required dependency first, or use '--force' to skip dependency checking (not recommended).")
525 }
526 Self::RemoteNotFound { .. } => {
527 Some("Check your repository configuration, or add a remote with 'atomic remote add <name> <url>'.")
528 }
529 Self::AuthenticationFailed { .. } => {
530 Some("Check your credentials. You may need to set up SSH keys or update your access token.")
531 }
532 Self::GitError { .. } => {
533 Some("A Git operation failed. Ensure you are in a valid Git repository, the referenced branch or commit exists, and you have the necessary permissions. Run 'git status' and 'git branch' to investigate.")
534 }
535 Self::IdentityNotFound(_) => {
536 Some("Run 'atomic identity list' to see available identities, or 'atomic identity new <name>' to create one.")
537 }
538 Self::IdentityAlreadyExists(_) => {
539 Some("Choose a different name, or use 'atomic identity show <name>' to view the existing identity.")
540 }
541 Self::Cancelled => None,
542 Self::InvalidArgument { .. } => {

Calls

no outgoing calls