rust - How to enter command line argument with docops? -
how can enter command line arguments in rust using docopts? i'd able enter u8 in vector , parse docopts.
you can use std::env::args method obtain iterator. then, can use .collect on iterator vector of strings.
use std::env; fn main () { let args: vec<string> = env::args().collect(); println!("{:?}", args); } example output:
simon@simon-desktop:~$ rustc t.rs simon@simon-desktop:~$ ./t abc def ["./t", "abc", "def"]
Comments
Post a Comment