aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs
index b38ee19..881c0d3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -72,9 +72,10 @@ enum Args {
#[clap(
short = 'P',
long = "public-dir",
+ default_value = ".",
help = "The static files directory to serve"
)]
- public_dir: Option<std::path::PathBuf>,
+ public_dir: std::path::PathBuf,
#[clap(
short = 'p',
long = "port",
@@ -149,24 +150,19 @@ async fn main() -> color_eyre::Result<()> {
println!("🌴 Project root: {}", change_dir.display().bright_yellow());
- let public_dir = if let Some(public_dir) = public_dir {
- if !public_dir.is_dir() {
- return Err(std::io::Error::new(
- std::io::ErrorKind::NotFound,
- format!("{} is not a directory", public_dir.display()),
- )
- .into());
- }
+ if !public_dir.is_dir() {
+ return Err(std::io::Error::new(
+ std::io::ErrorKind::NotFound,
+ format!("{} is not a directory", public_dir.display()),
+ )
+ .into());
+ }
- println!(
- "🌴 Public directory: {}",
- public_dir.display().bright_yellow()
- );
- Some(public_dir.canonicalize()?)
- } else {
- println!("🌴 Public directory: {}", "none".bright_yellow());
- None
- };
+ println!(
+ "🌴 Public directory: {}",
+ public_dir.display().bright_yellow()
+ );
+ let public_dir = Some(public_dir.canonicalize()?);
if local {
serve_locally(change_dir, true, port, public_dir).await