1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#![allow(unused_imports)]

pub(crate) use {
    crate::util::*, ci_provider::CIProvider,
    config::commands::locate_failure_log::locate_failure_log, config::Config,
};

pub(crate) use {
    anyhow::{bail, Context, Result},
    clap::{
        builder::styling::{AnsiColor, Effects, Styles},
        *,
    },
    config::commands,
    once_cell::sync::Lazy,
    regex::Regex,
    serde::{Deserialize, Serialize},
    std::{
        borrow, env,
        error::Error,
        fmt, fs, io,
        marker::PhantomData,
        path::{Path, PathBuf},
        process::{Command, ExitCode},
        sync::OnceLock,
    },
    strum::*,
};
// Imports for the Gitlab API v3
pub(crate) use gitlab::{
    api::{
        self,
        issues::ProjectIssues,
        projects::{self, issues, jobs},
        Query,
    },
    Gitlab,
};

/// Module containing macros related to protocol words.
pub mod macros {
    #[macro_export]
    // These macros are needed because the normal ones panic when there's a broken pipe.
    // This is especially problematic for CLI tools that are frequently piped into `head` or `grep -q`
    macro_rules! pipe_println {
        () => (print!("\n"));
        ($fmt:expr) => ({
            writeln!(io::stdout(), $fmt)
        });
        ($fmt:expr, $($arg:tt)*) => ({
            writeln!(io::stdout(), $fmt, $($arg)*)
        })
    }
    pub use pipe_println;

    #[macro_export]
    macro_rules! pipe_print {
        () => (print!("\n"));
        ($fmt:expr) => ({
            write!(io::stdout(), $fmt)
        });
        ($fmt:expr, $($arg:tt)*) => ({
            write!(io::stdout(), $fmt, $($arg)*)
        })
    }

    pub use pipe_print;
}

pub mod ci_provider;
pub mod config;
pub mod err_parse;
pub mod issue;
pub mod util;

pub use crate::run::run;
pub mod run;