use crate::cli::parser::RdfConfigArgs;
use crate::commands::base::{Command, CommandContext};
use anyhow::Result;
pub struct RdfConfigCommand {
args: RdfConfigArgs,
}
impl RdfConfigCommand {
pub fn new(args: RdfConfigArgs) -> Self {
Self { args }
}
}
impl Command for RdfConfigCommand {
fn name(&self) -> &'static str {
"rdf-config"
}
fn execute(&self, ctx: &mut CommandContext) -> Result<()> {
let format = self.args.format.into();
let result_format = self.args.result_format.into();
ctx.rudof
.load_rdf_config(&self.args.input)
.with_rdf_config_format(&format)
.execute()?;
ctx.rudof
.serialize_rdf_config(&mut ctx.writer)
.with_result_rdf_config_format(&result_format)
.execute()?;
Ok(())
}
}