-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tag-name = "v{{version}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ edition = "2021" | |
|
||
[dependencies] | ||
|
||
clap = "3" | ||
xtaskops = "^0.4.1" | ||
anyhow = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,67 @@ | ||
fn main() -> Result<(), anyhow::Error> { | ||
xtaskops::tasks::main() | ||
use anyhow::{self, Context}; | ||
/// main | ||
/// | ||
/// # Errors | ||
/// | ||
/// This function will return an error | ||
pub fn main() -> anyhow::Result<()> { | ||
use clap::{AppSettings, Arg, Command}; | ||
let cli = Command::new("xtask") | ||
.setting(AppSettings::SubcommandRequiredElseHelp) | ||
.subcommand( | ||
Command::new("coverage").arg( | ||
Arg::new("dev") | ||
.short('d') | ||
.long("dev") | ||
.help("generate an html report") | ||
.takes_value(false), | ||
), | ||
) | ||
.subcommand(Command::new("vars")) | ||
.subcommand(Command::new("ci")) | ||
.subcommand(Command::new("powerset")) | ||
.subcommand( | ||
Command::new("bloat-deps").arg( | ||
Arg::new("package") | ||
.short('p') | ||
.long("package") | ||
.help("package to build") | ||
.required(true) | ||
.takes_value(true), | ||
), | ||
) | ||
.subcommand( | ||
Command::new("bloat-time").arg( | ||
Arg::new("package") | ||
.short('p') | ||
.long("package") | ||
.help("package to build") | ||
.required(true) | ||
.takes_value(true), | ||
), | ||
) | ||
.subcommand(Command::new("docs")); | ||
let matches = cli.get_matches(); | ||
|
||
let root = xtaskops::ops::root_dir(); | ||
let res = match matches.subcommand() { | ||
Some(("coverage", sm)) => xtaskops::tasks::coverage(sm.is_present("dev")), | ||
Some(("vars", _)) => { | ||
println!("root: {root:?}"); | ||
Ok(()) | ||
} | ||
Some(("ci", _)) => xtaskops::tasks::ci(), | ||
Some(("docs", _)) => xtaskops::tasks::docs(), | ||
Some(("powerset", _)) => xtaskops::tasks::powerset(), | ||
Some(("bloat-deps", sm)) => xtaskops::tasks::bloat_deps( | ||
sm.get_one::<String>("package") | ||
.context("please provide a package with -p")?, | ||
), | ||
Some(("bloat-time", sm)) => xtaskops::tasks::bloat_time( | ||
sm.get_one::<String>("package") | ||
.context("please provide a package with -p")?, | ||
), | ||
_ => unreachable!("unreachable branch"), | ||
}; | ||
res | ||
} |