xref: /wasmtime-44.0.1/src/lib.rs (revision 8ca3af0e)
1 //! The Wasmtime command line interface (CLI) crate.
2 //!
3 //! This crate implements the Wasmtime command line tools.
4 
5 #![deny(
6     missing_docs,
7     trivial_numeric_casts,
8     unused_extern_crates,
9     unstable_features
10 )]
11 #![warn(unused_import_braces)]
12 #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../clippy.toml")))]
13 #![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
14 #![cfg_attr(
15     feature = "cargo-clippy",
16     warn(
17         clippy::float_arithmetic,
18         clippy::mut_mut,
19         clippy::nonminimal_bool,
20         clippy::map_unwrap_or,
21         clippy::unicode_not_nfc,
22         clippy::use_self
23     )
24 )]
25 
26 use wasmtime_cli_flags::{SUPPORTED_WASI_MODULES, SUPPORTED_WASM_FEATURES};
27 
28 lazy_static::lazy_static! {
29     static ref FLAG_EXPLANATIONS: String = {
30         use std::fmt::Write;
31 
32         let mut s = String::new();
33 
34         // Explain --wasm-features.
35         writeln!(&mut s, "Supported values for `--wasm-features`:").unwrap();
36         writeln!(&mut s).unwrap();
37         let max = SUPPORTED_WASM_FEATURES.iter().max_by_key(|(name, _)| name.len()).unwrap();
38         for (name, desc) in SUPPORTED_WASM_FEATURES.iter() {
39             writeln!(&mut s, "{:width$} {}", name, desc, width = max.0.len() + 2).unwrap();
40         }
41         writeln!(&mut s).unwrap();
42 
43         // Explain --wasi-modules.
44         writeln!(&mut s, "Supported values for `--wasi-modules`:").unwrap();
45         writeln!(&mut s).unwrap();
46         let max = SUPPORTED_WASI_MODULES.iter().max_by_key(|(name, _)| name.len()).unwrap();
47         for (name, desc) in SUPPORTED_WASI_MODULES.iter() {
48             writeln!(&mut s, "{:width$} {}", name, desc, width = max.0.len() + 2).unwrap();
49         }
50 
51         writeln!(&mut s).unwrap();
52         writeln!(&mut s, "Features prefixed with '-' will be disabled.").unwrap();
53 
54         s
55     };
56 }
57 
58 pub mod commands;
59