add config keys #31
11
src/app.rs
11
src/app.rs
@@ -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() {
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user