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)
| 601 | /// } |
| 602 | /// ``` |
| 603 | pub fn suggestion(&self) -> Option<&'static str> { |
| 604 | match self { |
| 605 | Self::RepositoryNotFound { .. } => { |
| 606 | Some("Vault searches and other repository commands require an Atomic repository. Run 'atomic init' to create one, or change to a directory inside an existing Atomic repository.") |
| 607 | } |
| 608 | Self::RepositoryExists { .. } => { |
| 609 | Some("The directory is already an Atomic repository. Use 'atomic status' to see its state.") |
| 610 | } |
| 611 | Self::ViewNotFound { .. } => { |
| 612 | Some("Run 'atomic view list' to see available views, or 'atomic view create <name>' to create a new one.") |
| 613 | } |
| 614 | Self::ViewAlreadyExists { .. } => { |
| 615 | Some("Choose a different name, or use 'atomic view switch <name>' to switch to the existing view.") |
| 616 | } |
| 617 | Self::CannotDeleteCurrentView { .. } => { |
| 618 | Some("Switch to a different view first with 'atomic view switch <name>', then delete this one.") |
| 619 | } |
| 620 | Self::FileNotFound { .. } => { |
| 621 | Some("Check that the file path is correct. Use 'ls' or your file manager to verify the file exists.") |
| 622 | } |
| 623 | Self::FileNotTracked { .. } => { |
| 624 | Some("Run 'atomic add <file>' to start tracking this file.") |
| 625 | } |
| 626 | Self::FileAlreadyTracked { .. } => { |
| 627 | Some("This file is already tracked. Use 'atomic status' to see its current state.") |
| 628 | } |
| 629 | Self::PathOutsideRepository { .. } => { |
| 630 | Some("Atomic can only track files within the repository. Move the file inside the repository or initialize a new repository in its parent directory.") |
| 631 | } |
| 632 | Self::NothingToRecord => { |
| 633 | Some("Make some changes to tracked files, or use 'atomic add' to track new files.") |
| 634 | } |
| 635 | Self::ChangeNotFound { .. } => { |
| 636 | Some("Run 'atomic log' to see available changes and their hashes.") |
| 637 | } |
| 638 | Self::AmbiguousHash { .. } => { |
| 639 | Some("Provide more characters of the hash to uniquely identify the change.") |
| 640 | } |
| 641 | Self::MissingDependency { .. } => { |
| 642 | Some("Insert the required dependency first, or use '--force' to skip dependency checking (not recommended).") |
| 643 | } |
| 644 | Self::RemoteNotFound { .. } => { |
| 645 | Some("Check your repository configuration, or add a remote with 'atomic remote add <name> <url>'.") |
| 646 | } |
| 647 | Self::AuthenticationFailed { .. } => { |
| 648 | Some("Check your credentials. You may need to set up SSH keys or update your access token.") |
| 649 | } |
| 650 | Self::GitError { .. } => { |
| 651 | 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.") |
| 652 | } |
| 653 | Self::StaleBaseline { .. } => Some( |
| 654 | "Follow the exact remediation commands in the stale-baseline report before retrying the refused operation.", |
| 655 | ), |
| 656 | Self::IdentityNotFound(_) => { |
| 657 | Some("Run 'atomic identity list' to see available identities, or 'atomic identity new <name>' to create one.") |
| 658 | } |
| 659 | Self::IdentityAlreadyExists(_) => { |
| 660 | Some("Choose a different name, or use 'atomic identity show <name>' to view the existing identity.") |
no outgoing calls