Skip to content
This repository was archived by the owner on Feb 16, 2025. It is now read-only.

Commit 1053b18

Browse files
committed
file-output: Output only to same directory as original file
1 parent cb6e5d6 commit 1053b18

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
name = "simple-ssg"
33
authors = ["Ryan Brue <[email protected]>"]
44
repository = "https://github.com/ryanabx/simple-ssg"
5+
website = "https://ryanabx.github.io/simple-ssg"
56
license = "MIT"
67
readme = "README.md"
7-
version = "4.0.2"
8+
version = "4.1.0"
89
edition = "2021"
910
description = "Plain and simple static site generator for Djot and Markdown light markup languages"
1011

src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ struct ConsoleArgs {
2424
/// Path to the directory to use to generate the site (not required if -f is specified)
2525
directory: Option<PathBuf>,
2626
/// Process a single file instead of a directory
27-
#[arg(short, conflicts_with = "clean")]
27+
#[arg(short, conflicts_with = "clean", conflicts_with = "output_path")]
2828
file: Option<PathBuf>,
2929
/// Optional output path override. Defaults to ./output for directories
30-
#[arg(short)]
30+
#[arg(short, conflicts_with = "file")]
3131
output_path: Option<PathBuf>,
3232
/// Clean the output directory before generating the site. Useful for multiple runs
3333
#[arg(long, conflicts_with = "file")]
@@ -72,7 +72,7 @@ fn run_program(args: ConsoleArgs) -> anyhow::Result<()> {
7272
if path.is_dir() {
7373
return Err(anyhow!("Path {} is a directory. Specify <DIRECTORY> without the -f positional argument if this was intended.", path.display()));
7474
}
75-
(path, args.output_path.unwrap_or(env::current_dir()?))
75+
(path.clone(), path.parent().unwrap().to_path_buf())
7676
} else {
7777
return Err(anyhow!(
7878
"Must specify either a directory <DIRECTORY> or a path with -f <PATH>"

0 commit comments

Comments
 (0)