add config keys

This commit is contained in:
2026-03-23 21:49:00 -05:00
parent 130525a868
commit 91bbfbc6d3
2 changed files with 51 additions and 0 deletions

View File

@@ -95,6 +95,8 @@ enum UtilSubcommand {
/// The build mode to generate for
mode: Option<String>,
},
/// Generate the config keys for Pallet.toml
GenConfigKeys,
}
#[derive(Clone, clap::ValueEnum)]
@@ -193,6 +195,15 @@ impl App {
std::process::exit(1);
}
}
UtilSubcommand::GenConfigKeys => {
println!(
"{} a property with a '?' indicates that the property is optional",
"Hint".yellow().bold()
);
for (id, desc, dt) in crate::config::Config::get_config_syntax() {
println!(" - {} ({}): {desc}", id.green().bold(), dt.blue().bold());
}
}
},
Subcommand::List => {
if let Err(e) = list() {

View File

@@ -35,6 +35,46 @@ impl Config {
self.build.iter().find(|bc| bc.name == self.default_build)
}
}
pub fn get_config_syntax() -> Vec<(String, String, String)> {
vec![
(
"compiler?",
"the compiler used by Pallet (defeault=gcc)",
"string",
),
("name", "the name of your application", "string"),
(
"default_build",
"the name of the build to use by default when running or building",
"string",
),
(
"description?",
"a brief description of your application",
"string",
),
("version?", "the version of your application", "string"),
(
"authors?",
"the author or authors of your application",
"string[]",
),
(
"build",
"a build config that can be used when compiling",
"{name: string, args: string[]}[]",
),
(
"dependencies",
"libraries (such as zlib) used by your application that require pkg-config to be compiled correclty",
"string[]"
)
]
.into_iter()
.map(|(a, b, c)| (a.to_owned(), b.to_owned(), c.to_owned()))
.collect()
}
}
#[derive(serde::Deserialize, serde::Serialize)]