1pub mod core;
3
4pub mod domain;
6
7pub mod adapters;
9
10pub mod commands;
12
13pub mod cli;
15
16pub mod test_utils;
18
19#[cfg(test)]
21pub mod examples;
22
23pub mod bisect;
28pub mod clean_branches;
29pub mod color_graph;
30pub mod command;
31pub mod contributors;
32pub mod fixup;
33pub mod graph;
34pub mod health;
35pub mod large_files;
37pub mod new_branch;
38pub mod prune_branches;
39pub mod rename_branch;
40pub mod since;
41pub mod stash_branch;
42pub mod summary;
43pub mod switch_recent;
44pub mod sync;
45pub mod technical_debt;
46pub mod undo;
47pub mod upstream;
48pub mod what;
49
50#[derive(Debug)]
52pub enum GitXError {
53 GitCommand(String),
54 Io(std::io::Error),
55 Parse(String),
56}
57
58impl std::fmt::Display for GitXError {
59 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60 match self {
61 GitXError::GitCommand(cmd) => write!(f, "Git command failed: {cmd}"),
62 GitXError::Io(err) => write!(f, "IO error: {err}"),
63 GitXError::Parse(msg) => write!(f, "Parse error: {msg}"),
64 }
65 }
66}
67
68impl std::error::Error for GitXError {
69 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
70 match self {
71 GitXError::Io(err) => Some(err),
72 GitXError::GitCommand(_) | GitXError::Parse(_) => None,
73 }
74 }
75}
76
77impl From<std::io::Error> for GitXError {
78 fn from(err: std::io::Error) -> Self {
79 GitXError::Io(err)
80 }
81}
82
83pub type Result<T> = std::result::Result<T, GitXError>;