From 1053b188318dfc365f48f53cfd22332c9f8a090d Mon Sep 17 00:00:00 2001 From: Ryan Brue Date: Mon, 9 Sep 2024 14:43:05 -0500 Subject: [PATCH] file-output: Output only to same directory as original file --- Cargo.lock | 2 +- Cargo.toml | 3 ++- src/main.rs | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f9bc57b..5eae502 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -331,7 +331,7 @@ dependencies = [ [[package]] name = "simple-ssg" -version = "4.0.2" +version = "4.1.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index a2f13dd..4c76e77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,10 @@ name = "simple-ssg" authors = ["Ryan Brue "] repository = "https://github.com/ryanabx/simple-ssg" +website = "https://ryanabx.github.io/simple-ssg" license = "MIT" readme = "README.md" -version = "4.0.2" +version = "4.1.0" edition = "2021" description = "Plain and simple static site generator for Djot and Markdown light markup languages" diff --git a/src/main.rs b/src/main.rs index 2809a70..00cd7d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,10 +24,10 @@ struct ConsoleArgs { /// Path to the directory to use to generate the site (not required if -f is specified) directory: Option, /// Process a single file instead of a directory - #[arg(short, conflicts_with = "clean")] + #[arg(short, conflicts_with = "clean", conflicts_with = "output_path")] file: Option, /// Optional output path override. Defaults to ./output for directories - #[arg(short)] + #[arg(short, conflicts_with = "file")] output_path: Option, /// Clean the output directory before generating the site. Useful for multiple runs #[arg(long, conflicts_with = "file")] @@ -72,7 +72,7 @@ fn run_program(args: ConsoleArgs) -> anyhow::Result<()> { if path.is_dir() { return Err(anyhow!("Path {} is a directory. Specify without the -f positional argument if this was intended.", path.display())); } - (path, args.output_path.unwrap_or(env::current_dir()?)) + (path.clone(), path.parent().unwrap().to_path_buf()) } else { return Err(anyhow!( "Must specify either a directory or a path with -f "