summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-05-29 16:34:49 +0530
committerSebastian Thiel <sthiel@thoughtworks.com>2019-05-29 16:34:49 +0530
commite9a447250ba9ffd10f94f6f7d970c6da141c185d (patch)
tree1f7cef8b6c5ca783c0e37eae77251ed6e5346e63 /src
First instantiation of template
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs7
-rw-r--r--src/main.rs40
2 files changed, 47 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..a1ed88e
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,7 @@
+extern crate failure;
+
+use failure::Error;
+
+pub fn fun() -> Result<(), Error> {
+ unimplemented!();
+}
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..57406a9
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,40 @@
+extern crate failure;
+extern crate failure_tools;
+extern crate dua;
+#[macro_use]
+extern crate structopt;
+
+use failure::Error;
+use failure_tools::ok_or_exit;
+use structopt::StructOpt;
+
+mod options {
+ use std::path::PathBuf;
+
+ #[derive(Debug, StructOpt)]
+ #[structopt(name = "example", about = "An example of StructOpt usage.")]
+ pub struct Args {
+ /// Activate debug mode
+ #[structopt(short = "d", long = "debug")]
+ debug: bool,
+ /// Set speed
+ #[structopt(short = "s", long = "speed", default_value = "42")]
+ speed: f64,
+ /// Input file
+ #[structopt(parse(from_os_str))]
+ input: PathBuf,
+ /// Output file, stdout if not present
+ #[structopt(parse(from_os_str))]
+ output: Option<PathBuf>,
+ }
+}
+
+fn run() -> Result<(), Error> {
+ let opt = options::Args::from_args();
+ println!("{:?}", opt);
+ dua::fun()
+}
+
+fn main() {
+ ok_or_exit(run())
+}