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

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -