use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use vyuh::{
SiteConf, bundles,
commands::{CommandArgs, CommandConf, CommandError},
};
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
struct GreetArgs {
name: String,
#[serde(default)]
verbose: bool,
}
async fn greet(args: CommandArgs<GreetArgs>) -> Result<(), CommandError> {
if args.verbose {
println!("running greet command");
}
println!("hello {}", args.name);
Ok(())
}
#[tokio::main]
async fn main() -> Result<(), vyuh::SiteError> {
let bundle = bundles::bundle([bundles::command(
greet,
CommandConf::new("greet").description("Print a greeting."),
)]);
vyuh::run_command(SiteConf::from_env_with_files()?, bundle).await
}