move clap; fix version

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-20 08:11:05 +00:00 committed by June 🍓🦴
parent 74832bdc47
commit 2dd5cf8c68
4 changed files with 11 additions and 10 deletions

View file

@ -13,7 +13,6 @@ use tracing::debug;
use crate::{Error, Result};
pub mod clap;
pub mod content_disposition;
pub mod defer;

View file

@ -2,19 +2,18 @@
use std::path::PathBuf;
pub use clap::Parser;
use super::conduwuit_version;
use clap::Parser;
use conduit_core::utils::conduwuit_version;
/// Commandline arguments
#[derive(Parser, Debug)]
#[clap(version = conduwuit_version(), about, long_about = None)]
pub struct Args {
pub(crate) struct Args {
#[arg(short, long)]
/// Optional argument to the path of a conduwuit config TOML file
pub config: Option<PathBuf>,
pub(crate) config: Option<PathBuf>,
}
/// Parse commandline arguments into structured data
#[must_use]
pub fn parse() -> Args { Args::parse() }
pub(crate) fn parse() -> Args { Args::parse() }

View file

@ -1,3 +1,4 @@
pub(crate) mod clap;
mod mods;
mod server;
@ -5,7 +6,7 @@ extern crate conduit_core as conduit;
use std::{cmp, sync::Arc, time::Duration};
use conduit::{debug_info, error, utils::clap, Error, Result};
use conduit::{debug_info, error, Error, Result};
use server::Server;
use tokio::runtime;

View file

@ -5,12 +5,14 @@ use conduit::{
config::Config,
info,
log::{LogLevelReloadHandles, ReloadHandle},
utils::{clap, maximize_fd_limit},
utils::maximize_fd_limit,
Error, Result,
};
use tokio::runtime;
use tracing_subscriber::{prelude::*, reload, EnvFilter, Registry};
use crate::clap::Args;
/// Server runtime state; complete
pub(crate) struct Server {
/// Server runtime state; public portion
@ -27,7 +29,7 @@ pub(crate) struct Server {
}
impl Server {
pub(crate) fn build(args: clap::Args, runtime: Option<&runtime::Handle>) -> Result<Arc<Server>, Error> {
pub(crate) fn build(args: Args, runtime: Option<&runtime::Handle>) -> Result<Arc<Server>, Error> {
let config = Config::new(args.config)?;
#[cfg(feature = "sentry_telemetry")]
let sentry_guard = init_sentry(&config);