Changing loremaster to loreweaver.

This commit is contained in:
2025-09-25 11:36:59 -04:00
parent 6ec711f7ed
commit 655dc8e90f
9 changed files with 45 additions and 21 deletions

33
loreweaver/src/info.rs Normal file
View File

@ -0,0 +1,33 @@
//! This is where the cargo build information can be retrieved from.
/// The environment variable defined by Cargo for the name.
const NAME: Option<&str> = option_env!("CARGO_PKG_NAME");
/// The environment variable defined by Cargo for the version.
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
/// The string to display if a value is not defined during compile time.
const NOT_DEFINED: &'static str = "UNDEFINED";
/// Returns the name of the program as defined by the CARGO_PKG_NAME. This is
/// set at compile time and comes from the Cargo.toml file.
///
/// If a value is not found, then it will return the not defined value.
pub fn get_name() -> &'static str
{
NAME.unwrap_or(NOT_DEFINED)
}
/// Returns the version of the program as defined by the CARGO_PKG_VERSION.
/// This is set at compile time and comes from the Cargo.toml file.
///
/// If a value is not found, then it will return the not defined value.
pub fn get_version() -> &'static str
{
VERSION.unwrap_or(NOT_DEFINED)
}

37
loreweaver/src/main.rs Normal file
View File

@ -0,0 +1,37 @@
//! Converts a blog repository into an SQLite database using the Tavern blog system.
mod info;
use clap::Parser;
use tavern::{Database, Tavern};
#[derive(Parser)]
#[command(version, about)]
struct Options
{
#[arg(short = 'c', long = "config", default_value = "Tavern.toml")]
config_file: std::path::PathBuf,
#[arg(short = 'o', long = "output", default_value = "tavern.db")]
output: std::path::PathBuf
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>>
{
let options = Options::parse();
let tavern: Tavern = Tavern::from_config_file(&options.config_file);
let database = Database::open(&options.output).await?;
database.insert_tavern(&tavern).await?;
Ok(())
}