xtask/cli/
mod.rs

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

pub(crate) mod devtools_test;
pub(crate) mod r_cmd_check;

use devtools_test::DevtoolsTestArg;
use r_cmd_check::RCmdCheckArg;

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

#[derive(Subcommand, Debug)]
pub(crate) enum Commands {
    #[command(about = "Run cargo fmt on extendr")]
    CheckFmt,
    #[command(about = "Run `cargo fmt` on extendr crates")]
    Fmt,
    #[command(about = "Run R CMD check on {extendrtests}")]
    RCmdCheck(RCmdCheckArg),
    #[command(about = "Generate documentation for all features")]
    Doc,
    #[command(about = "Check that the specified rust-version is MSRV")]
    Msrv,
    #[command(about = "Run devtools::test() on {extendrtests} and generate snapshots")]
    DevtoolsTest(DevtoolsTestArg),
    #[command(about = "Generate wrappers by `rextendr::document()`")]
    Document,
}

pub(crate) fn parse() -> Cli {
    Cli::parse()
}