summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..6d3fe4d
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,34 @@
+#![allow(clippy::multiple_crate_versions)]
+use anyhow::Result;
+use clap::Parser;
+use reqwest::StatusCode;
+use tracing::instrument;
+
+mod cli;
+mod command;
+mod http;
+mod nix;
+
+use cli::Cli;
+use command::Run;
+
+#[derive(Clone, Debug, thiserror::Error)]
+enum Error {
+ #[error("Unstable to complete HTTP request: {0}")]
+ HTTPFailed(StatusCode),
+ #[error("Nix exited with code {code}: {stderr}")]
+ Nix { code: i32, stderr: String },
+}
+
+#[tokio::main]
+#[instrument]
+async fn main() -> Result<()> {
+ tracing_subscriber::fmt::init();
+
+ let cli = Cli::parse();
+ if let Err(why) = cli.run().await {
+ eprintln!("{why}");
+ }
+
+ Ok(())
+}