summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--src/cli.rs21
2 files changed, 22 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 853cbee..889aa0c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,3 +35,4 @@ hyper = "0.12"
itertools = "0.7"
tokio = { version = "0.2", features = ["full"] }
add_getters_setters = "1.1"
+structopt = "0.3"
diff --git a/src/cli.rs b/src/cli.rs
new file mode 100644
index 0000000..dddff76
--- /dev/null
+++ b/src/cli.rs
@@ -0,0 +1,21 @@
+use std::path::PathBuf;
+
+use structopt::StructOpt;
+use failure::Error;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "example", about = "An example of StructOpt usage.")]
+pub struct CLI {
+ #[structopt(short, long)]
+ debug: bool,
+
+ #[structopt(short, long)]
+ trace: bool,
+
+ #[structopt(parse(from_os_str))]
+ configfile: Option<PathBuf>,
+}
+
+pub fn cli() -> Result<CLI, Error> {
+ Ok(CLI::from_args())
+}