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
use anyhow::Result;
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    /// Coverage with tech instrument-coverage, deps llvm-tools-preview & grcov
    Coverage {
        /// generate an html report
        #[arg(short, long, default_value_t = false)]
        dev: bool,
        /// coveralls to stdout for neovim plugin
        #[arg(long, default_value_t = false)]
        neo: bool,
    },
    /// Regular ci tests: fmt, clippy, test
    Ci,
    /// Run cargo docs in watch mode
    Docs,
}

pub mod ops;

/// Main entrypoint.
///
/// # Errors
/// error if tasks failed.
pub fn make() -> Result<()> {
    let cli = Cli::parse();
    match &cli.command {
        Commands::Ci => xtaskops::tasks::ci(),
        Commands::Docs => xtaskops::tasks::docs(),
        Commands::Coverage { dev, neo: false } => xtaskops::tasks::coverage(*dev),
        Commands::Coverage { neo: true, .. } => ops::neo_coverage(),
    }
}