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

Method suggestion

atomic-cli/src/error.rs:544–618  ·  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

542 /// }
543 /// ```
544 pub fn suggestion(&self) -> Option<&'static str> {
545 match self {
546 Self::RepositoryNotFound { .. } => {
547 Some("Run 'atomic init' to create a new repository, or change to a directory inside an existing repository.")
548 }
549 Self::RepositoryExists { .. } => {
550 Some("The directory is already an Atomic repository. Use 'atomic status' to see its state.")
551 }
552 Self::ViewNotFound { .. } => {
553 Some("Run 'atomic view list' to see available views, or 'atomic view create <name>' to create a new one.")
554 }
555 Self::ViewAlreadyExists { .. } => {
556 Some("Choose a different name, or use 'atomic view switch <name>' to switch to the existing view.")
557 }
558 Self::CannotDeleteCurrentView { .. } => {
559 Some("Switch to a different view first with 'atomic view switch <name>', then delete this one.")
560 }
561 Self::FileNotFound { .. } => {
562 Some("Check that the file path is correct. Use 'ls' or your file manager to verify the file exists.")
563 }
564 Self::FileNotTracked { .. } => {
565 Some("Run 'atomic add <file>' to start tracking this file.")
566 }
567 Self::FileAlreadyTracked { .. } => {
568 Some("This file is already tracked. Use 'atomic status' to see its current state.")
569 }
570 Self::PathOutsideRepository { .. } => {
571 Some("Atomic can only track files within the repository. Move the file inside the repository or initialize a new repository in its parent directory.")
572 }
573 Self::NothingToRecord => {
574 Some("Make some changes to tracked files, or use 'atomic add' to track new files.")
575 }
576 Self::ChangeNotFound { .. } => {
577 Some("Run 'atomic log' to see available changes and their hashes.")
578 }
579 Self::AmbiguousHash { .. } => {
580 Some("Provide more characters of the hash to uniquely identify the change.")
581 }
582 Self::MissingDependency { .. } => {
583 Some("Insert the required dependency first, or use '--force' to skip dependency checking (not recommended).")
584 }
585 Self::RemoteNotFound { .. } => {
586 Some("Check your repository configuration, or add a remote with 'atomic remote add <name> <url>'.")
587 }
588 Self::AuthenticationFailed { .. } => {
589 Some("Check your credentials. You may need to set up SSH keys or update your access token.")
590 }
591 Self::GitError { .. } => {
592 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.")
593 }
594 Self::IdentityNotFound(_) => {
595 Some("Run 'atomic identity list' to see available identities, or 'atomic identity new <name>' to create one.")
596 }
597 Self::IdentityAlreadyExists(_) => {
598 Some("Choose a different name, or use 'atomic identity show <name>' to view the existing identity.")
599 }
600 Self::ConflictMarkers { .. } => Some(
601 "Edit the file to remove the '>>>>>>>' / '=======' / '<<<<<<<' lines and keep the content you want, then record again. Run 'atomic conflicts' to list every conflict, or pass '--allow-conflict-markers' if the markers are legitimate content.",

Calls

no outgoing calls