mirror of
https://github.com/cobalt-org/cobalt.rs
synced 2024-11-10 06:14:12 +00:00
Merge pull request #1196 from epage/dest
fix(serve): Don't offer unused `--destination`
This commit is contained in:
commit
629f2691a7
2 changed files with 14 additions and 14 deletions
|
@ -11,10 +11,6 @@ pub(crate) struct ConfigArgs {
|
|||
#[arg(short, long, value_name = "FILE")]
|
||||
config: Option<path::PathBuf>,
|
||||
|
||||
/// Site destination folder [default: ./_site]
|
||||
#[arg(short, long, value_name = "DIR")]
|
||||
destination: Option<path::PathBuf>,
|
||||
|
||||
/// Include drafts.
|
||||
#[arg(long)]
|
||||
drafts: bool,
|
||||
|
@ -37,15 +33,6 @@ impl ConfigArgs {
|
|||
cobalt_config::Config::from_cwd(".")?
|
||||
};
|
||||
|
||||
config.abs_dest = self
|
||||
.destination
|
||||
.as_deref()
|
||||
.map(|d| {
|
||||
std::fs::create_dir_all(d)?;
|
||||
dunce::canonicalize(d)
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
if let Some(drafts) = self.drafts() {
|
||||
config.include_drafts = drafts;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,26 @@ use crate::error::Result;
|
|||
/// Build the cobalt project at the source dir
|
||||
#[derive(Clone, Debug, PartialEq, Eq, clap::Args)]
|
||||
pub(crate) struct BuildArgs {
|
||||
/// Site destination folder [default: ./_site]
|
||||
#[arg(short, long, value_name = "DIR", help_heading = "Config")]
|
||||
destination: Option<std::path::PathBuf>,
|
||||
|
||||
#[command(flatten, next_help_heading = "Config")]
|
||||
pub(crate) config: args::ConfigArgs,
|
||||
}
|
||||
|
||||
impl BuildArgs {
|
||||
pub(crate) fn run(&self) -> Result<()> {
|
||||
let config = self.config.load_config()?;
|
||||
let mut config = self.config.load_config()?;
|
||||
config.abs_dest = self
|
||||
.destination
|
||||
.as_deref()
|
||||
.map(|d| {
|
||||
fs::create_dir_all(d)?;
|
||||
dunce::canonicalize(d)
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let config = cobalt::cobalt_model::Config::from_config(config)?;
|
||||
|
||||
build(config)?;
|
||||
|
|
Loading…
Reference in a new issue