aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-02-08 15:13:36 -0800
committerFuwn <[email protected]>2025-06-09 00:46:04 -0700
commit0ae5e3b93ebcec299619f04da09c024705c98098 (patch)
treeb4ad1d9befcfec5af6a597ff1c2b5c293b24295a
parentfix(divina_git): match log style (diff)
downloadarchived-divina-0ae5e3b93ebcec299619f04da09c024705c98098.tar.xz
archived-divina-0ae5e3b93ebcec299619f04da09c024705c98098.zip
feat(cli): config compiler show subcommand
-rw-r--r--crates/divina/src/cli.rs20
-rw-r--r--crates/divina_compile/src/lib.rs7
2 files changed, 24 insertions, 3 deletions
diff --git a/crates/divina/src/cli.rs b/crates/divina/src/cli.rs
index 6a843b7..c256927 100644
--- a/crates/divina/src/cli.rs
+++ b/crates/divina/src/cli.rs
@@ -17,9 +17,7 @@ fn cli() -> App<'static, 'static> {
.takes_value(true)
.possible_values(&["bin", "lib"]),
Arg::with_name("git").long("git").takes_value(true),
- Arg::with_name("path")
- .index(1)
- .takes_value(true),
+ Arg::with_name("path").index(1).takes_value(true),
]),
SubCommand::with_name("build").about("Build your project"),
SubCommand::with_name("clean")
@@ -30,6 +28,12 @@ fn cli() -> App<'static, 'static> {
.subcommands(vec![
SubCommand::with_name("show").about("Print your configuration"),
SubCommand::with_name("validate").about("Check if your configuration will compile"),
+ SubCommand::with_name("compiler")
+ .about("Access the Divina compiler wrapper")
+ .setting(AppSettings::SubcommandRequiredElseHelp)
+ .subcommands(vec![
+ SubCommand::with_name("show").about("Print Divina's compiler configuration")
+ ]),
]),
])
.args(&[
@@ -71,6 +75,16 @@ pub fn execute(divina: &mut crate::Divina) {
match s_matches.subcommand() {
("show", _) => divina.print_config(),
("validate", _) => println!(":: no issues found"),
+ ("compiler", Some(s_s_matches)) =>
+ match s_s_matches.subcommand() {
+ ("show", _) => {
+ let _ = divina
+ .compiler
+ .find_sources(&divina.expose_config().clone())
+ .print_config();
+ }
+ _ => unreachable!(),
+ },
_ => unreachable!(),
},
_ => unreachable!(),
diff --git a/crates/divina_compile/src/lib.rs b/crates/divina_compile/src/lib.rs
index ec37f6d..603066e 100644
--- a/crates/divina_compile/src/lib.rs
+++ b/crates/divina_compile/src/lib.rs
@@ -283,6 +283,13 @@ impl Compiler {
}
}
}
+
+ #[must_use]
+ pub fn print_config(&self) -> &Self {
+ println!("{:?}", self);
+
+ self
+ }
}
#[cfg(windows)]