I'm trying to print all the argument of a command
let text_output= matches.value_of_lossy( "text").unwrap();
but it just print the first element for example if i write
cargo run -- hello world
the output = hello
the src code :
use clap::{App, Arg};
fn main() {
let matches = App::new("echo")
.version("1.0.0")
.author("unknown")
.about("echo Command with Rust")
.arg(
Arg::with_name("text")
.value_name("TEXT")
.help("input text")
.required(true)
.min_values(1),
)
.arg(
Arg::with_name("new_line")
.short("n")
.help("don'tmake a newLine")
.takes_value(false),
)
.get_matches();
let text_output= matches.value_of_lossy( "text").unwrap();
let new_line = matches.is_present("new_line");
let ending = if new_line{""}else{"\n"};
print!("{}{}", text_output, ending);
}
i try :
print!("{}{}", text_output.join(" "), ending);
and i get this err :
^^^^ method not found in `Cow<'_, str>`