Getting dependencies and such setup properly.
This commit is contained in:
commit
8ce0631155
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/target
|
||||
/Cargo.lock
|
||||
.zedstate
|
15
Cargo.toml
Normal file
15
Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
|
||||
name = "Led"
|
||||
version = "0.0.1"
|
||||
authors = ["Nathan Vegdahl <cessen@cessen.com>"]
|
||||
|
||||
[[bin]]
|
||||
name = "led"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies.docopt]
|
||||
git = "https://github.com/docopt/docopt.rs.git"
|
||||
|
||||
[dependencies.rustbox]
|
||||
git = "https://github.com/gchp/rustbox.git"
|
31
src/main.rs
Normal file
31
src/main.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
extern crate rustbox;
|
||||
extern crate docopt;
|
||||
extern crate serialize;
|
||||
|
||||
use docopt::Docopt;
|
||||
|
||||
|
||||
// Usage documentation string
|
||||
static USAGE: &'static str = "
|
||||
Usage: led <file>
|
||||
led --help
|
||||
|
||||
Options:
|
||||
-h, --help Show this message
|
||||
";
|
||||
|
||||
|
||||
// Struct for storing command-line arguments
|
||||
#[deriving(Decodable, Show)]
|
||||
struct Args {
|
||||
arg_file: String,
|
||||
flag_help: bool,
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
// Get command-line arguments
|
||||
let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()).unwrap_or_else(|e| e.exit());
|
||||
|
||||
println!("Hello! {}", args.arg_file);
|
||||
}
|
Loading…
Reference in New Issue
Block a user