Skip to content

Commit

Permalink
feat: color eyre (#288)
Browse files Browse the repository at this point in the history
* feat: provide new cli with clap

* feat: provide axum http server

* feat: makes host and port optional

* feat: move into modular structure

* feat: add color-eyre as a dependecy

---------

Co-authored-by: Esteban Borai <estebanborai@gmail.com>
  • Loading branch information
Phosphorus-M and EstebanBorai committed May 15, 2023
1 parent df5f423 commit bbd1848
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 1 deletion.
163 changes: 163 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ path = "src/main.rs"
axum = "0.6.18"
clap = { version = "4.2.7", features = ["derive"] }
tokio = { version = "1.28.1", features = ["macros", "rt-multi-thread"] }
color-eyre = "0.6.2"

[profile.release]
debug = 1


[profile.dev.package.backtrace]
opt-level = 1
5 changes: 5 additions & 0 deletions src/extension/file_server.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use std::path::PathBuf;

pub struct FileServer {

Check failure on line 3 in src/extension/file_server.rs

View workflow job for this annotation

GitHub Actions / clippy

struct `FileServer` is never constructed

Check warning on line 3 in src/extension/file_server.rs

View workflow job for this annotation

GitHub Actions / Builds for ubuntu-latest

struct `FileServer` is never constructed

Check warning on line 3 in src/extension/file_server.rs

View workflow job for this annotation

GitHub Actions / Builds for macos-latest

struct `FileServer` is never constructed

Check warning on line 3 in src/extension/file_server.rs

View workflow job for this annotation

GitHub Actions / Builds for windows-latest

struct `FileServer` is never constructed
root_dir: PathBuf,
}
1 change: 1 addition & 0 deletions src/extension/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod file_server;
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
mod cli;
mod extension;
mod server;

use clap::Parser;
use color_eyre::eyre::Result;

use self::cli::Cli;
use self::server::Server;

#[tokio::main]
async fn main() {
async fn main() -> Result<()> {
color_eyre::install()?;

let cli = Cli::parse();
let address = cli.address();
let server = Server::from(cli);
Expand All @@ -18,4 +22,5 @@ async fn main() {
.serve(server.router().into_make_service())
.await
.unwrap();
Ok(())
}

0 comments on commit bbd1848

Please sign in to comment.