Skip to content

Commit

Permalink
file-output: Output only to same directory as original file
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanabx committed Sep 9, 2024
1 parent cb6e5d6 commit 1053b18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
name = "simple-ssg"
authors = ["Ryan Brue <[email protected]>"]
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"

Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ struct ConsoleArgs {
/// Path to the directory to use to generate the site (not required if -f is specified)
directory: Option<PathBuf>,
/// Process a single file instead of a directory
#[arg(short, conflicts_with = "clean")]
#[arg(short, conflicts_with = "clean", conflicts_with = "output_path")]
file: Option<PathBuf>,
/// Optional output path override. Defaults to ./output for directories
#[arg(short)]
#[arg(short, conflicts_with = "file")]
output_path: Option<PathBuf>,
/// Clean the output directory before generating the site. Useful for multiple runs
#[arg(long, conflicts_with = "file")]
Expand Down Expand Up @@ -72,7 +72,7 @@ fn run_program(args: ConsoleArgs) -> anyhow::Result<()> {
if path.is_dir() {
return Err(anyhow!("Path {} is a directory. Specify <DIRECTORY> 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 <DIRECTORY> or a path with -f <PATH>"
Expand Down

0 comments on commit 1053b18

Please sign in to comment.