Tried using a string YAML with clap on the Rust playground, but it does not run due to the yaml feature not being enabled. Here is an example code:
use clap;
use yaml_rust; // Needs the `yaml` feature
fn yaml_literal() -> &'static str {
return r#"
args:
- json:
about: Output in the JSON format for machine readability and scripting purposes.
long: json
global: true
- plain:
about: Output plain text of the output without extra information, for machine readability and scripting purposes.
long: plain
global: true
- debug:
about: Output debug messages.
long: debug
global: true
"#;
}
fn main() {
let yaml = yaml_rust::YamlLoader::load_from_str(yaml_literal())
.unwrap()
.get(0)
.unwrap();
let app = clap::App::from_yaml(yaml);
println!("{}", app.render_usage());
}
Describe the solution you'd like
Please add a list of features (including 'yaml') under [package.metadata.playground] section in your Cargo.toml file. Because it is currently not present, only the default features are enabled on the rust playground. That severely limits the use of clap, because there is no other way to enable crate features on the Rust Playground.
Issue by shivanandvp Monday Dec 06, 2021 at 08:12 GMT Originally opened as https://github.com/clap-rs/clap/issues/3065
Please complete the following tasks
Clap Version
2.34.0
Describe your use case
Tried using a string YAML with
clap
on the Rust playground, but it does not run due to theyaml
feature not being enabled. Here is an example code:Describe the solution you'd like
Please add a list of features (including 'yaml') under
[package.metadata.playground]
section in yourCargo.toml
file. Because it is currently not present, only the default features are enabled on the rust playground. That severely limits the use ofclap
, because there is no other way to enable crate features on the Rust Playground.Alternatives, if applicable
None.
Additional Context
No response