new: add interactive wizard and remaining ecosystem templates
This commit is contained in:
+13
-5
@@ -234,13 +234,14 @@ fn main() {
|
||||
|
||||
match matches.subcommand() {
|
||||
Some(("new", sub_matches)) => {
|
||||
// Without the interactive wizard (follow-up work), missing
|
||||
// required answers produce one error listing all of them;
|
||||
// --defaults fills everything else from the defaults.
|
||||
let depends: Vec<String> = sub_matches
|
||||
.get_many::<String>("depends")
|
||||
.map(|values| values.cloned().collect())
|
||||
.unwrap_or_default();
|
||||
let no_verify = sub_matches
|
||||
.get_one::<bool>("no_verify")
|
||||
.copied()
|
||||
.unwrap_or(false);
|
||||
let cli = pkh::new::options::NewCli {
|
||||
name: sub_matches.get_one::<String>("name").cloned(),
|
||||
lang: sub_matches.get_one::<String>("lang").cloned(),
|
||||
@@ -275,9 +276,16 @@ fn main() {
|
||||
.unwrap_or(false),
|
||||
};
|
||||
|
||||
// The wizard (interactive terminal) fills the same NewCli and
|
||||
// resolves through the same pipeline; without a TTY the resolve
|
||||
// error lists every missing answer. Afterwards the two
|
||||
// verification builds are offered (`--no-verify` skips them;
|
||||
// the structural self-checks inside `scaffold` always run).
|
||||
if let Err(e) = rt.block_on(async {
|
||||
let opts = pkh::new::options::resolve(cli).await?;
|
||||
pkh::new::scaffold(opts, &multi)
|
||||
let opts = pkh::new::questions::run(cli).await?;
|
||||
pkh::new::scaffold(opts.clone(), &multi)?;
|
||||
pkh::new::questions::offer_verification(&opts, &multi, no_verify).await;
|
||||
Ok::<(), Box<dyn std::error::Error>>(())
|
||||
}) {
|
||||
error!("{}", e);
|
||||
std::process::exit(1);
|
||||
|
||||
Reference in New Issue
Block a user