summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..32333f1
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,36 @@
+#[macro_use]
+extern crate clap;
+
+fn main() {
+ let matches = clap_app!(pjournal =>
+ (version: "0.1")
+ (author: "KJ Ørbekk <kj@orbekk.com>")
+ (about: "Practice Journaling")
+ (@arg strava_client_secret:
+ --strava_client_secret
+ +required +takes_value
+ "Client secret for strava authentication")
+ (@arg strava_client_id:
+ --strava_client_id
+ +required +takes_value
+ "Client id for strava authentication")
+ (@arg base_url:
+ --base_url
+ +takes_value
+ "Endpoint for this web app")
+ )
+ .get_matches();
+
+ let config = pjournal::Config {
+ client_id: matches
+ .value_of("strava_client_id")
+ .unwrap().to_string(),
+ client_secret: matches
+ .value_of("strava_client_secret")
+ .unwrap().to_string(),
+ base_url: matches
+ .value_of("base_url")
+ .unwrap_or("http://localhost:8000").to_string(),
+ };
+ pjournal::start_server(config);
+}