From 91bbfbc6d38b73fc5bf740a792e4bc7b420f4ddd Mon Sep 17 00:00:00 2001 From: Shea Frembling Date: Mon, 23 Mar 2026 21:49:00 -0500 Subject: [PATCH] add config keys --- src/app.rs | 11 +++++++++++ src/config.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/app.rs b/src/app.rs index 603bb0c..faa5517 100644 --- a/src/app.rs +++ b/src/app.rs @@ -95,6 +95,8 @@ enum UtilSubcommand { /// The build mode to generate for mode: Option, }, + /// 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() { diff --git a/src/config.rs b/src/config.rs index f2421a8..dba9c0c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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)]