Created
June 29, 2017 23:46
-
-
Save jcdyer/c92033fd835b1900dd501a373f056d63 to your computer and use it in GitHub Desktop.
Hello command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "hello" | |
version = "0.1.0" | |
authors = ["J. Cliff Dyer <[email protected]>"] | |
[dependencies] | |
clap = "~2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate clap; | |
use clap::{App, Arg}; | |
fn main() { | |
let matches = App::new("Hello World") | |
//.author("Triangle Rustaceans") | |
//.about("Say hello.") | |
//.version("1.0") | |
.arg(Arg::with_name("name") | |
.short("n") | |
.long("name") | |
//.value_name("NAME") | |
//.help("Who do you want to greet?") | |
.takes_value(true)) | |
.get_matches(); | |
let greetee = matches.value_of("name").unwrap_or("world"); | |
println!("Hello {}!", greetee); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment