Added documentation.
This commit is contained in:
12
src/setup.rs
12
src/setup.rs
@@ -1,3 +1,7 @@
|
||||
//! Handles configuration for the bot.
|
||||
//!
|
||||
//! Both command line, and configuration file options are handled here.
|
||||
|
||||
use clap::Parser;
|
||||
use color_eyre::{Result, eyre::WrapErr};
|
||||
use config::Config;
|
||||
@@ -6,6 +10,7 @@ use std::path::PathBuf;
|
||||
use tracing::{info, instrument};
|
||||
|
||||
// TODO: use [clap(long, short, help_heading = Some(section))]
|
||||
/// Struct of potential arguments.
|
||||
#[derive(Clone, Debug, Parser)]
|
||||
#[command(about, version)]
|
||||
pub struct Args {
|
||||
@@ -30,6 +35,7 @@ pub struct Args {
|
||||
pub instruct: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
/// Name of the model to use. E.g. 'deepseek-chat'
|
||||
pub model: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
@@ -65,11 +71,17 @@ pub struct Args {
|
||||
pub use_tls: Option<bool>,
|
||||
}
|
||||
|
||||
/// Handle for interacting with the bot configuration.
|
||||
pub struct Setup {
|
||||
/// Handle for the configuration file options.
|
||||
pub config: Config,
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
/// Initialize a new [`Setup`] instance.
|
||||
///
|
||||
/// This reads the settings file which becomes the bot's default configuration.
|
||||
/// These settings shall be overridden by any command line options.
|
||||
pub async fn init() -> Result<Setup> {
|
||||
// Get arguments. These overrule configuration file, and environment
|
||||
// variables if applicable.
|
||||
|
||||
Reference in New Issue
Block a user