From 476e8316e6ad4d090867670bee376fa38ee3aad3 Mon Sep 17 00:00:00 2001 From: Tim Docker Date: Sat, 11 Feb 2023 22:04:18 +1100 Subject: [PATCH] switch to using clap derive for command line parsing --- rust/compiler/Cargo.lock | 249 +++++++++++++++++++++----------- rust/compiler/Cargo.toml | 2 +- rust/compiler/src/cli/ast.rs | 2 +- rust/compiler/src/cli/mod.rs | 91 +++++++----- rust/compiler/src/cli/rust.rs | 8 +- rust/compiler/src/cli/verify.rs | 2 +- 6 files changed, 222 insertions(+), 132 deletions(-) diff --git a/rust/compiler/Cargo.lock b/rust/compiler/Cargo.lock index f9a5477c..af3af335 100644 --- a/rust/compiler/Cargo.lock +++ b/rust/compiler/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.61" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "bitflags" @@ -25,15 +25,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytecount" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" +checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" [[package]] name = "cc" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -41,13 +41,50 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clap" +version = "4.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "compiler" version = "0.1.0" dependencies = [ "anyhow", + "clap", "env_logger", - "gumdrop", "log", "nom", "nom_locate", @@ -90,33 +127,16 @@ dependencies = [ ] [[package]] -name = "gumdrop" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc700f989d2f6f0248546222d9b4258f5b02a171a431f8285a81c08142629e3" -dependencies = [ - "gumdrop_derive", -] - -[[package]] -name = "gumdrop_derive" -version = "0.8.1" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729f9bd3449d77e7831a18abfb7ba2f99ee813dfd15b8c2167c9a54ba20aa99d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "humantime" @@ -126,9 +146,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "io-lifetimes" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", "windows-sys", @@ -136,9 +156,9 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" dependencies = [ "hermit-abi", "io-lifetimes", @@ -148,21 +168,21 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "linux-raw-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "log" @@ -175,9 +195,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "minimal-lexical" @@ -187,9 +207,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -197,38 +217,74 @@ dependencies = [ [[package]] name = "nom_locate" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37794436ca3029a3089e0b95d42da1f0b565ad271e4d3bb4bad0c7bb70b10605" +checksum = "b1e299bf5ea7b212e811e71174c5d1a5d065c4c0ad0c8691ecb1f97e3e66025e" dependencies = [ "bytecount", "memchr", "nom", ] +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[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", + "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.36" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.17" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -243,9 +299,9 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rustix" -version = "0.36.5" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", @@ -257,24 +313,24 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -283,40 +339,52 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" -version = "1.0.90" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] -name = "unicode-xid" -version = "0.2.2" +name = "unicode-ident" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "winapi" @@ -351,9 +419,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -366,42 +443,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" diff --git a/rust/compiler/Cargo.toml b/rust/compiler/Cargo.toml index 38fa79b4..93179e3b 100644 --- a/rust/compiler/Cargo.toml +++ b/rust/compiler/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0.61" -gumdrop = "0.8.1" +clap = { version = "4.1.4", features = ["derive"] } serde = { version = "1.0.130", features=["derive"] } serde_json = "1.0.68" nom = "7.0.0" diff --git a/rust/compiler/src/cli/ast.rs b/rust/compiler/src/cli/ast.rs index 39693152..69cf25c7 100644 --- a/rust/compiler/src/cli/ast.rs +++ b/rust/compiler/src/cli/ast.rs @@ -6,7 +6,7 @@ use crate::processing::loader::loader_from_search_paths; use crate::processing::resolver::{Module1, Resolver}; pub fn ast(opts: &AstOpts) -> anyhow::Result<()> { - let loader = loader_from_search_paths(&opts.searchdir); + let loader = loader_from_search_paths(&opts.search.path); let mut resolver = Resolver::new(loader); for m in &opts.modules { let r = resolver.add_module(m); diff --git a/rust/compiler/src/cli/mod.rs b/rust/compiler/src/cli/mod.rs index 93d8393e..0212d5f3 100644 --- a/rust/compiler/src/cli/mod.rs +++ b/rust/compiler/src/cli/mod.rs @@ -1,21 +1,21 @@ -use gumdrop::Options; +use clap::{Args, Parser, Subcommand}; use std::path::PathBuf; pub mod ast; pub mod rust; pub mod verify; + + + + pub fn run_cli() -> i32 { - let opts = CliOptions::parse_args_default_or_exit(); + let cli = Cli::parse(); - let r = match opts.command { - None => { - println!("{}", CliOptions::self_usage(&opts)); - Ok(()) - } - Some(Command::Verify(opts)) => verify::verify(&opts), - Some(Command::Ast(opts)) => ast::ast(&opts), - Some(Command::Rust(opts)) => rust::rust(&opts), + let r = match cli.command { + Command::Verify(opts) => verify::verify(&opts), + Command::Ast(opts) => ast::ast(&opts), + Command::Rust(opts) => rust::rust(&opts), }; match r { Ok(_) => 0, @@ -26,56 +26,69 @@ pub fn run_cli() -> i32 { } } -// Define options for the program. -#[derive(Debug, Options)] -pub struct CliOptions { - #[options(help = "print help message")] - pub help: bool, - #[options(command)] - pub command: Option, +#[derive(Parser)] +#[command(name = "adlc")] +#[command(author = "Tim Docker")] +#[command(version = "0.1")] +#[command(about = "ADL code generation cli tool", long_about = None)] +struct Cli { + #[command(subcommand)] + command: Command, } -#[derive(Debug, Options)] +#[derive(Debug, Parser)] pub enum Command { - #[options(help = "verify ADL")] + /// verify ADL Verify(VerifyOpts), - #[options(help = "generate the json AST for some ADL")] + /// generate the json AST for some ADL modules Ast(AstOpts), - #[options(help = "generate rust code for the specified ADL")] + /// generate rust code for the some ADL modules Rust(RustOpts), } -#[derive(Debug, Options)] +#[derive(Debug, Args)] pub struct VerifyOpts { - #[options(help = "adds the given directory to the ADL search path", meta = "I")] - pub searchdir: Vec, - #[options(free)] + #[clap(flatten)] + pub search: AdlSearchOpts, + pub modules: Vec, } -#[derive(Debug, Options)] +#[derive(Debug, Args)] pub struct AstOpts { - #[options(help = "adds the given directory to the ADL search path", meta = "I")] - pub searchdir: Vec, + #[clap(flatten)] + pub search: AdlSearchOpts, - #[options(help = "writes the AST to the specified file", meta = "O")] + /// writes the AST to the specified file" + #[arg(long, short='O', value_name="FILE")] pub outfile: Option, - #[options(free)] pub modules: Vec, } -#[derive(Debug, Options)] +#[derive(Debug, Args)] pub struct RustOpts { - #[options(help = "adds the given directory to the ADL search path", meta = "I")] - pub searchdir: Vec, + #[clap(flatten)] + pub search: AdlSearchOpts, - #[options( - help = "writes the generated rust to the specified directory", - meta = "O" - )] - pub outdir: PathBuf, + #[clap(flatten)] + pub output: OutputOpts, - #[options(free)] pub modules: Vec, } + + +#[derive(Debug, Args)] +pub struct AdlSearchOpts { + /// adds the given directory to the ADL search path + #[arg(long="searchdir", short='I', value_name="DIR")] + pub path: Vec, +} + +#[derive(Debug, Args)] +pub struct OutputOpts { + /// writes generated code to the specified directory + #[arg(long, short='O', value_name="DIR")] + pub outdir: PathBuf, +} + diff --git a/rust/compiler/src/cli/rust.rs b/rust/compiler/src/cli/rust.rs index 82590c1b..de3438e6 100644 --- a/rust/compiler/src/cli/rust.rs +++ b/rust/compiler/src/cli/rust.rs @@ -10,7 +10,7 @@ use crate::processing::resolver::{Module1, Resolver, TypeExpr1}; use crate::processing::writer::TreeWriter; pub fn rust(opts: &RustOpts) -> anyhow::Result<()> { - let loader = loader_from_search_paths(&opts.searchdir); + let loader = loader_from_search_paths(&opts.search.path); let mut resolver = Resolver::new(loader); for m in &opts.modules { let r = resolver.add_module(m); @@ -25,7 +25,7 @@ pub fn rust(opts: &RustOpts) -> anyhow::Result<()> { .map(|mn| resolver.get_module(&mn).unwrap()) .collect(); - let writer = TreeWriter::new(opts.outdir.clone()); + let writer = TreeWriter::new(opts.output.outdir.clone()); for m in modules { let path = path_from_module_name(m.name.to_owned()); @@ -58,7 +58,7 @@ fn generate_code(m: &Module1) -> anyhow::Result { } fn gen_struct( - m: &Module1, + _m: &Module1, d: &adlast::Decl, s: &adlast::Struct, out: &mut String, @@ -71,6 +71,6 @@ fn gen_struct( Ok(()) } -fn gen_type_expr(te: &TypeExpr1) -> String { +fn gen_type_expr(_te: &TypeExpr1) -> String { "TYPE".to_owned() } diff --git a/rust/compiler/src/cli/verify.rs b/rust/compiler/src/cli/verify.rs index d87e5762..fdf696de 100644 --- a/rust/compiler/src/cli/verify.rs +++ b/rust/compiler/src/cli/verify.rs @@ -5,7 +5,7 @@ use anyhow::anyhow; use crate::processing::{loader::loader_from_search_paths, resolver::Resolver}; pub fn verify(opts: &VerifyOpts) -> anyhow::Result<()> { - let loader = loader_from_search_paths(&opts.searchdir); + let loader = loader_from_search_paths(&opts.search.path); let mut resolver = Resolver::new(loader); for m in &opts.modules { let r = resolver.add_module(m);