begun development for single file generation
All checks were successful
Test the running changes / Test (push) Successful in 40s
All checks were successful
Test the running changes / Test (push) Successful in 40s
This commit is contained in:
@@ -10,14 +10,17 @@ use std::net::Ipv4Addr;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Generate { force: bool },
|
Generate { force: bool, single: bool },
|
||||||
Serve { addr: Ipv4Addr, port: u16 },
|
Serve { addr: Ipv4Addr, port: u16 },
|
||||||
Init,
|
Init,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Command {
|
impl Default for Command {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::Generate { force: true }
|
Self::Generate {
|
||||||
|
force: true,
|
||||||
|
single: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,10 +70,18 @@ impl TryFrom<Args> for Command {
|
|||||||
comm = Command::Init;
|
comm = Command::Init;
|
||||||
}
|
}
|
||||||
// `gravel` command
|
// `gravel` command
|
||||||
else if let Some(a) = value.next() {
|
for a in value {
|
||||||
Err(Error::CommandLineArgsParse(format!(
|
match a.as_str() {
|
||||||
"Unexpected argument: `{a}`"
|
"-s" => {
|
||||||
)))?;
|
comm = Command::Generate {
|
||||||
|
force: true,
|
||||||
|
single: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => Err(Error::CommandLineArgsParse(format!(
|
||||||
|
"Unknown argument: `{a}`"
|
||||||
|
)))?,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(comm)
|
Ok(comm)
|
||||||
|
|||||||
@@ -15,9 +15,16 @@ fn run() -> Result<(), Error> {
|
|||||||
let conf = ProgramConfig::new("gravel.toml", std::env::args())?;
|
let conf = ProgramConfig::new("gravel.toml", std::env::args())?;
|
||||||
|
|
||||||
match conf.command {
|
match conf.command {
|
||||||
Command::Init => todo!("project init not implemented"),
|
Command::Init => todo!("project init"),
|
||||||
Command::Serve { addr, port } => serve(addr, port, conf.outdir)?,
|
Command::Serve { addr, port } => serve(addr, port, conf.outdir)?,
|
||||||
Command::Generate { force } => generate(&conf.indir, &conf.outdir, force)?,
|
Command::Generate {
|
||||||
|
force,
|
||||||
|
single: false,
|
||||||
|
} => generate(&conf.indir, &conf.outdir, force)?,
|
||||||
|
Command::Generate {
|
||||||
|
force: _f,
|
||||||
|
single: true,
|
||||||
|
} => todo!("single file generation"),
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user