diff --git a/Cargo.lock b/Cargo.lock index b6f3005ff..a478ceb61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,15 +60,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "1.0.0" @@ -157,17 +148,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.5.1" @@ -393,21 +373,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width 0.1.14", - "vec_map", -] - [[package]] name = "clap" version = "4.6.4" @@ -427,7 +392,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -436,7 +401,7 @@ version = "4.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 3.0.5", @@ -471,7 +436,7 @@ checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c" dependencies = [ "encode_unicode", "libc", - "unicode-width 0.2.2", + "unicode-width", "windows-sys 0.61.2", ] @@ -603,7 +568,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.119", ] @@ -616,7 +581,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.119", ] @@ -689,7 +654,7 @@ dependencies = [ "swc_eq_ignore_macros", "text_lines", "thiserror", - "unicode-width 0.2.2", + "unicode-width", "url", ] @@ -870,7 +835,7 @@ dependencies = [ "indexmap 2.14.0", "rustc-hash", "serde", - "unicode-width 0.2.2", + "unicode-width", ] [[package]] @@ -1273,30 +1238,12 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" @@ -1363,6 +1310,7 @@ dependencies = [ "anyhow", "build-fs-tree", "cargo_metadata", + "clap", "colored", "convert_case 0.12.0", "dialoguer", @@ -1386,7 +1334,6 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "structopt", "syn 3.0.5", "thiserror", "tokio", @@ -1784,7 +1731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c460d4fa06223667240720ab69a8045133755ae6dfbe100cf481b95e3a014f1" dependencies = [ "ahash", - "clap 4.6.4", + "clap", "crossbeam-channel", "crossbeam-utils", "dashmap", @@ -1805,7 +1752,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d57a3e447e24c22647738e4607f1df1e0ec6f72e16182c4cd199f647cdfb0e4" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.119", @@ -2444,30 +2391,6 @@ dependencies = [ "syn 3.0.5", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.107" @@ -3131,42 +3054,12 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "strum" version = "0.27.2" @@ -3179,7 +3072,7 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.119", @@ -3233,7 +3126,7 @@ dependencies = [ "swc_eq_ignore_macros", "swc_visit", "tracing", - "unicode-width 0.2.2", + "unicode-width", "url", ] @@ -3424,15 +3317,6 @@ dependencies = [ "serde", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width 0.1.14", -] - [[package]] name = "thiserror" version = "2.0.20" @@ -3711,12 +3595,6 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.2" @@ -3824,12 +3702,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.5" @@ -3906,22 +3778,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.11" @@ -3931,12 +3787,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.62.2" diff --git a/Cargo.toml b/Cargo.toml index 9fa281ad0..1c47d610c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ path-clean = "1.0.1" regex = "1.6.0" serde_yaml = "0.9.34" serde_json = "1" -structopt = "0.3.11" +clap = { version = "4", features = ["derive"] } thiserror = "2.0" tokio = { version = "1.11", features = ["full"] } toml = "1.1.4" diff --git a/src/bin/hc-scaffold.rs b/src/bin/hc-scaffold.rs index 84affdf35..9c54a7f05 100644 --- a/src/bin/hc-scaffold.rs +++ b/src/bin/hc-scaffold.rs @@ -1,10 +1,10 @@ +use clap::Parser; use colored::Colorize; use holochain_scaffolding_cli::cli::HcScaffold; -use structopt::StructOpt; #[tokio::main] async fn main() -> anyhow::Result<()> { - if let Err(e) = HcScaffold::from_args().run().await { + if let Err(e) = HcScaffold::parse().run().await { eprintln!("{}", e.to_string().red()); } Ok(()) diff --git a/src/cli.rs b/src/cli.rs index 4a8efa034..668051b3e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -5,9 +5,9 @@ use crate::file_tree::load_directory_into_memory; use crate::scaffold::config::ScaffoldConfig; use crate::scaffold::web_app::template_type::TemplateType; +use clap::Parser; use colored::Colorize; use std::{path::Path, str::FromStr}; -use structopt::StructOpt; mod collection; mod dna; @@ -18,24 +18,28 @@ mod template; mod web_app; mod zome; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] +#[command(version, propagate_version = true)] pub struct HcScaffold { - #[structopt(short, long, parse(try_from_str = TemplateType::from_str))] + #[arg(short, long, value_parser = TemplateType::from_str)] /// The template to use for the hc-scaffold commands. /// Can either be an option from the built-in templates: "svelte", "headless", /// or a path to a custom template. template: Option, - #[structopt(subcommand)] + #[command(subcommand)] command: HcScaffoldCommand, } /// A command-line interface for creating and modifying a Holochain application (hApp). -#[derive(Debug, StructOpt)] -#[structopt(setting = structopt::clap::AppSettings::InferSubcommands)] +#[derive(Debug, clap::Subcommand)] +#[command(infer_subcommands = true)] pub enum HcScaffoldCommand { WebApp(web_app::WebApp), - Template(template::Template), + Template { + #[command(subcommand)] + command: template::Template, + }, Dna(dna::Dna), Zome(zome::Zome), EntryType(entry_type::EntryType), @@ -52,7 +56,7 @@ impl HcScaffold { match self.command { HcScaffoldCommand::WebApp(web_app) => web_app.run(&template_type).await, - HcScaffoldCommand::Template(template) => template.run(&template_type), + HcScaffoldCommand::Template { command } => command.run(&template_type), HcScaffoldCommand::Dna(dna) => dna.run(&template_type), HcScaffoldCommand::Zome(zome) => zome.run(&template_type), HcScaffoldCommand::EntryType(entry_type) => entry_type.run(&template_type), @@ -95,3 +99,52 @@ impl HcScaffold { } } } + +#[cfg(test)] +mod tests { + use clap::{error::ErrorKind, Parser}; + + use super::{HcScaffold, HcScaffoldCommand}; + + #[test] + fn entry_type_accepts_space_separated_fields() { + let cli = HcScaffold::try_parse_from([ + "hc-scaffold", + "entry-type", + "post", + "--fields", + "title:String", + "body:String", + ]) + .expect("space-separated fields should parse"); + + let HcScaffoldCommand::EntryType(entry_type) = cli.command else { + panic!("entry-type arguments should produce the entry-type command"); + }; + let fields = entry_type.fields.expect("fields should be present"); + + assert_eq!(fields.len(), 2); + } + + #[test] + fn version_is_available_to_all_subcommands() { + let cases: &[&[&str]] = &[ + &["hc-scaffold", "web-app", "--version"], + &["hc-scaffold", "template", "--version"], + &["hc-scaffold", "template", "new", "--version"], + &["hc-scaffold", "dna", "--version"], + &["hc-scaffold", "zome", "--version"], + &["hc-scaffold", "entry-type", "--version"], + &["hc-scaffold", "link-type", "--version"], + &["hc-scaffold", "collection", "--version"], + &["hc-scaffold", "example", "--version"], + ]; + + for args in cases { + let error = HcScaffold::try_parse_from(*args) + .expect_err("version requests should stop argument parsing"); + + assert_eq!(error.kind(), ErrorKind::DisplayVersion, "{args:?}"); + } + } +} diff --git a/src/cli/collection.rs b/src/cli/collection.rs index 4e368158d..d47db7847 100644 --- a/src/cli/collection.rs +++ b/src/cli/collection.rs @@ -1,8 +1,8 @@ use std::str::FromStr; +use clap::Parser; use colored::Colorize; use convert_case::Case; -use structopt::StructOpt; use crate::{ file_tree::{build_file_tree, load_directory_into_memory}, @@ -17,14 +17,14 @@ use crate::{ utils::{check_case, input_with_case, run_cargo_fmt_if_available}, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold a collection of entries in an existing zome pub struct Collection { - #[structopt(long)] + #[arg(long)] /// Name of the dna in which you want to scaffold the zome pub dna: Option, - #[structopt(long)] + #[arg(long)] /// Name of the integrity zome in which you want to scaffold the link type pub zome: Option, @@ -34,15 +34,15 @@ pub struct Collection { /// Collection name, just to differentiate it from other collections pub collection_name: Option, - #[structopt(parse(try_from_str = EntryTypeReference::from_str))] + #[arg(value_parser = EntryTypeReference::from_str)] /// Entry type that is going to be added to the collection pub entry_type: Option, - #[structopt(long)] + #[arg(long)] /// Skips UI generation for this collection. pub no_ui: bool, - #[structopt(long)] + #[arg(long)] /// Skips test generation for this collection. pub no_spec: bool, } diff --git a/src/cli/dna.rs b/src/cli/dna.rs index 1865cf2f5..705e72cda 100644 --- a/src/cli/dna.rs +++ b/src/cli/dna.rs @@ -1,6 +1,6 @@ +use clap::Parser; use colored::Colorize; use convert_case::Case; -use structopt::StructOpt; use crate::{ file_tree::{build_file_tree, load_directory_into_memory}, @@ -9,10 +9,10 @@ use crate::{ utils::{check_case, input_with_case}, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold a DNA into an existing app pub struct Dna { - #[structopt(long)] + #[arg(long)] /// Name of the app in which you want to scaffold the DNA pub app: Option, diff --git a/src/cli/entry_type.rs b/src/cli/entry_type.rs index 3652b50a2..eb490d33b 100644 --- a/src/cli/entry_type.rs +++ b/src/cli/entry_type.rs @@ -1,8 +1,8 @@ use std::str::FromStr; +use clap::Parser; use colored::Colorize; use convert_case::Case; -use structopt::StructOpt; use crate::{ file_tree::{build_file_tree, load_directory_into_memory}, @@ -16,46 +16,51 @@ use crate::{ utils::{check_case, input_with_case, run_cargo_fmt_if_available}, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold an entry type and CRUD functions into an existing zome pub struct EntryType { - #[structopt(long)] + #[arg(long)] /// Name of the dna in which you want to scaffold the entry type pub dna: Option, - #[structopt(long)] + #[arg(long)] /// Name of the integrity zome in which you want to scaffold the entry definition pub zome: Option, /// Name of the entry type being scaffolded pub name: Option, - #[structopt(long)] + #[arg(long)] /// Whether this entry type should be referenced with its "EntryHash" or its "ActionHash" /// If referred to by "EntryHash", the entries can't be updated or deleted pub reference_entry_hash: Option, - #[structopt(long, parse(try_from_str = Crud::from_str))] + #[arg(long, value_parser = Crud::from_str)] /// The Create, "Read", "Update", and "Delete" zome call functions that should be scaffolded for this entry type /// If "--reference-entry-hash" is "true", only "Create" and "Read" will be scaffolded pub crud: Option, - #[structopt(long)] + #[arg(long)] /// Whether to create a link from the original entry to each update action /// Only applies if update is selected in the "crud" argument pub link_from_original_to_each_update: Option, - #[structopt(long, value_delimiter = ",", parse(try_from_str = FieldDefinition::from_str))] + #[arg( + long, + num_args = 1.., + value_delimiter = ',', + value_parser = FieldDefinition::from_str + )] /// The fields that the entry type struct should contain /// Syntax: ::: , (widget and linked_from are optional) /// Eg. "title:String:TextField" , "posts_hashes:Vec\::Post" pub fields: Option>, - #[structopt(long)] + #[arg(long)] /// Skips UI generation for this entry-type, overriding any specified widgets in the --fields option. pub no_ui: bool, - #[structopt(long)] + #[arg(long)] /// Skips test generation for this entry-type pub no_spec: bool, } diff --git a/src/cli/example.rs b/src/cli/example.rs index 8c855ce5c..1ae4d2412 100644 --- a/src/cli/example.rs +++ b/src/cli/example.rs @@ -1,8 +1,8 @@ use std::{ffi::OsString, path::PathBuf}; use build_fs_tree::{Build, MergeableFileSystemTree}; +use clap::Parser; use colored::Colorize; -use structopt::StructOpt; use tokio::fs; use crate::{ @@ -31,10 +31,10 @@ use crate::{ const FORUM: &str = "forum"; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold an example hApp pub struct Example { - #[structopt(long)] + #[arg(long)] /// Whether to setup the holonix development environment for the example hApp pub setup_nix: Option, } diff --git a/src/cli/link_type.rs b/src/cli/link_type.rs index 29d1487bb..75347d098 100644 --- a/src/cli/link_type.rs +++ b/src/cli/link_type.rs @@ -1,7 +1,7 @@ use std::str::FromStr; +use clap::Parser; use colored::Colorize; -use structopt::StructOpt; use crate::{ file_tree::{build_file_tree, load_directory_into_memory}, @@ -13,38 +13,38 @@ use crate::{ utils::run_cargo_fmt_if_available, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold a link type and its appropriate zome functions into an existing zome pub struct LinkType { - #[structopt(long)] + #[arg(long)] /// Name of the dna in which you want to scaffold the zome pub dna: Option, - #[structopt(long)] + #[arg(long)] /// Name of the integrity zome in which you want to scaffold the link type pub zome: Option, - #[structopt(parse(try_from_str = Referenceable::from_str))] + #[arg(value_parser = Referenceable::from_str)] /// Entry type (or agent role) used as the base for the links pub from_referenceable: Option, - #[structopt(parse(try_from_str = Referenceable::from_str))] + #[arg(value_parser = Referenceable::from_str)] /// Entry type (or agent role) used as the target for the links pub to_referenceable: Option, - #[structopt(long)] + #[arg(long)] /// Whether to create the inverse link, from the "--to-referenceable" entry type to the "--from-referenceable" entry type pub bidirectional: Option, - #[structopt(long)] + #[arg(long)] /// Whether this link type can be deleted pub delete: Option, - #[structopt(long)] + #[arg(long)] /// Skips UI generation for this link-type. pub no_ui: bool, - #[structopt(long)] + #[arg(long)] /// Skips test generation for this link-type. pub no_spec: bool, } diff --git a/src/cli/template.rs b/src/cli/template.rs index 7d33e4893..85c4d8d40 100644 --- a/src/cli/template.rs +++ b/src/cli/template.rs @@ -1,19 +1,19 @@ use std::{ffi::OsString, path::PathBuf}; use build_fs_tree::{dir, file, Build, MergeableFileSystemTree}; -use structopt::StructOpt; +use clap::Subcommand; use crate::{scaffold::web_app::template_type::TemplateType, utils::input_with_case}; -#[derive(Debug, StructOpt)] -#[structopt(setting = structopt::clap::AppSettings::InferSubcommands)] +#[derive(Debug, Subcommand)] +#[command(infer_subcommands = true)] /// Manage custom templates pub enum Template { /// Create a new template from an existing scaffolding template New, /// Clone the template in use into a new custom template Clone { - #[structopt(long)] + #[arg(long)] /// The folder to initialize the template into, will end up at "" to_template: Option, }, diff --git a/src/cli/web_app.rs b/src/cli/web_app.rs index d6715fbbf..b2f2a7530 100644 --- a/src/cli/web_app.rs +++ b/src/cli/web_app.rs @@ -3,9 +3,9 @@ use std::{ path::{Path, PathBuf}, }; +use clap::Parser; use colored::Colorize; use convert_case::{Case, Casing}; -use structopt::StructOpt; use tokio::fs; use crate::{ @@ -26,7 +26,7 @@ use crate::{ utils::{input_no_whitespace, input_with_case, input_yes_or_no, validate_input}, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold a new, empty web app pub struct WebApp { /// Name of the app to scaffold @@ -35,11 +35,11 @@ pub struct WebApp { /// Description of the app to scaffold pub description: Option, - #[structopt(long)] + #[arg(long)] /// Whether to setup the holonix development environment for this web-app pub setup_nix: bool, - #[structopt(long, short = "F")] + #[arg(long, short = 'F')] /// Whether to skip setting up an initial DNA and it's zome(s) after the web app is scaffolded pub disable_fast_track: bool, } diff --git a/src/cli/zome.rs b/src/cli/zome.rs index 86ea5876d..34347ea29 100644 --- a/src/cli/zome.rs +++ b/src/cli/zome.rs @@ -1,9 +1,9 @@ use std::{ffi::OsString, path::PathBuf}; use build_fs_tree::{Build, MergeableFileSystemTree}; +use clap::Parser; use colored::Colorize; use convert_case::Case; -use structopt::StructOpt; use crate::{ file_tree::load_directory_into_memory, @@ -20,21 +20,21 @@ use crate::{ utils::{check_case, input_with_case, run_cargo_fmt_if_available}, }; -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] /// Scaffold one or multiple zomes into an existing DNA pub struct Zome { - #[structopt(long)] + #[arg(long)] /// Name of the dna in which you want to scaffold the zome pub dna: Option, /// Name of the zome being scaffolded pub name: Option, - #[structopt(long, parse(from_os_str))] + #[arg(long)] /// Scaffold an integrity zome at the given path pub integrity: Option, - #[structopt(long, parse(from_os_str))] + #[arg(long)] /// Scaffold a coordinator zome at the given path pub coordinator: Option, }