move 'serve' command logic into a submodule of 'cli'

The changes to 'main.rs' and 'cli/serve.rs' in this commit are almost
pure code-motion.
This commit is contained in:
Benjamin Lee 2024-09-05 21:09:13 -07:00
parent be87774a3b
commit 86515d53cc
No known key found for this signature in database
GPG key ID: FB9624E2885D55A4
3 changed files with 677 additions and 659 deletions

View file

@ -1,9 +1,16 @@
//! Integration with `clap`
//!
//! CLI argument structs are defined in this module. Execution logic for each
//! command goes in a submodule.
use std::path::PathBuf;
use clap::{Parser, Subcommand};
use crate::error;
mod serve;
/// Command line arguments
#[derive(Parser)]
#[clap(
@ -49,3 +56,11 @@ pub(crate) struct ServeArgs {
#[clap(flatten)]
pub(crate) config: ConfigArg,
}
impl Args {
pub(crate) async fn run(self) -> Result<(), error::Main> {
match self.command {
Command::Serve(args) => serve::run(args).await,
}
}
}