Skip to content

Commit 9a66d4d

Browse files
committed
fix(serve): Don't offer unused --destination
Fixes #1189
1 parent 494f2c2 commit 9a66d4d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/bin/cobalt/args.rs

-13
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ pub(crate) struct ConfigArgs {
1111
#[arg(short, long, value_name = "FILE")]
1212
config: Option<path::PathBuf>,
1313

14-
/// Site destination folder [default: ./_site]
15-
#[arg(short, long, value_name = "DIR")]
16-
destination: Option<path::PathBuf>,
17-
1814
/// Include drafts.
1915
#[arg(long)]
2016
drafts: bool,
@@ -37,15 +33,6 @@ impl ConfigArgs {
3733
cobalt_config::Config::from_cwd(".")?
3834
};
3935

40-
config.abs_dest = self
41-
.destination
42-
.as_deref()
43-
.map(|d| {
44-
std::fs::create_dir_all(d)?;
45-
dunce::canonicalize(d)
46-
})
47-
.transpose()?;
48-
4936
if let Some(drafts) = self.drafts() {
5037
config.include_drafts = drafts;
5138
}

src/bin/cobalt/build.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,26 @@ use crate::error::Result;
77
/// Build the cobalt project at the source dir
88
#[derive(Clone, Debug, PartialEq, Eq, clap::Args)]
99
pub(crate) struct BuildArgs {
10+
/// Site destination folder [default: ./_site]
11+
#[arg(short, long, value_name = "DIR", help_heading = "Config")]
12+
destination: Option<std::path::PathBuf>,
13+
1014
#[command(flatten, next_help_heading = "Config")]
1115
pub(crate) config: args::ConfigArgs,
1216
}
1317

1418
impl BuildArgs {
1519
pub(crate) fn run(&self) -> Result<()> {
16-
let config = self.config.load_config()?;
20+
let mut config = self.config.load_config()?;
21+
config.abs_dest = self
22+
.destination
23+
.as_deref()
24+
.map(|d| {
25+
fs::create_dir_all(d)?;
26+
dunce::canonicalize(d)
27+
})
28+
.transpose()?;
29+
1730
let config = cobalt::cobalt_model::Config::from_config(config)?;
1831

1932
build(config)?;

0 commit comments

Comments
 (0)