summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-04-28 19:51:18 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-04-28 20:27:15 +0200
commitb2bb2d91d824b395c17e72c81aa3efd2574d6e0f (patch)
treec4b9ab9b1c3ce5eee083455591a43e403b56d6e8
parent7533256d9ab21d455ad5691c2a68940bd30b72d9 (diff)
Add simple CLI definition for later
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-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())
+}