Created the loremaster.
This is an application that uses tavern to create/publish a database from a blog repository.
This commit is contained in:
@ -10,3 +10,6 @@ readme = "README.md"
|
|||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
clap = { version = "4.5.46", features = ["derive"] }
|
||||||
|
tavern = { version = "0.2.4", path = "../tavern", registry = "cybermages", features = ["publisher"] }
|
||||||
|
tokio = { version = "1.47.1", features = ["rt-multi-thread", "macros"] }
|
||||||
|
|||||||
@ -4,15 +4,34 @@ mod info;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Print the version.
|
use clap::Parser;
|
||||||
fn print_version()
|
|
||||||
|
use tavern::{Database, Tavern};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[command(version, about)]
|
||||||
|
struct Options
|
||||||
{
|
{
|
||||||
println!("{} v{}", info::get_name(), info::get_version());
|
#[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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn main()
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Box<dyn std::error::Error>>
|
||||||
{
|
{
|
||||||
print_version();
|
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(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user