mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
wip: add export subcommand
Currently exports: * Server name * PDUs * Public signing keys
This commit is contained in:
parent
adb174d985
commit
2ff415a562
3 changed files with 441 additions and 0 deletions
23
src/cli.rs
23
src/cli.rs
|
|
@ -13,6 +13,7 @@ use crate::{
|
|||
};
|
||||
|
||||
mod check_config;
|
||||
mod export;
|
||||
mod serve;
|
||||
|
||||
/// Command line arguments
|
||||
|
|
@ -33,6 +34,9 @@ pub(crate) enum Command {
|
|||
|
||||
/// Check the configuration file for syntax and semantic errors.
|
||||
CheckConfig(CheckConfigArgs),
|
||||
|
||||
/// Export all persistent data.
|
||||
Export(ExportArgs),
|
||||
}
|
||||
|
||||
#[derive(clap::Args)]
|
||||
|
|
@ -44,6 +48,18 @@ pub(crate) struct CheckConfigArgs {
|
|||
observability: ObservabilityArgs,
|
||||
}
|
||||
|
||||
#[derive(clap::Args)]
|
||||
pub(crate) struct ExportArgs {
|
||||
#[clap(flatten)]
|
||||
config: ConfigArg,
|
||||
|
||||
#[clap(flatten)]
|
||||
observability: ObservabilityArgs,
|
||||
|
||||
#[clap(short, long)]
|
||||
out_dir: PathBuf,
|
||||
}
|
||||
|
||||
/// Wrapper for the `--config` arg.
|
||||
///
|
||||
/// This exists to centralize the `mut_arg` code that sets the help value based
|
||||
|
|
@ -99,6 +115,9 @@ impl Args {
|
|||
Command::CheckConfig(args) => {
|
||||
check_config::run(args.config).await?;
|
||||
}
|
||||
Command::Export(args) => {
|
||||
export::run(args).await?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -113,6 +132,10 @@ impl Command {
|
|||
args.observability.log_format,
|
||||
args.observability.log_filter.clone(),
|
||||
)),
|
||||
Command::Export(args) => Some((
|
||||
args.observability.log_format,
|
||||
args.observability.log_filter.clone(),
|
||||
)),
|
||||
Command::Serve(_) => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue