wasmer_cli/commands/journal/
inspect.rs

1use std::path::PathBuf;
2
3use clap::Parser;
4use wasmer_wasix::journal::{LogFileJournal, PrintingJournal, copy_journal};
5
6use crate::commands::CliCommand;
7
8/// Prints a summarized version of contents of a journal to stdout
9#[derive(Debug, Parser)]
10pub struct CmdJournalInspect {
11    /// Path to the journal that will be printed
12    #[clap(index = 1)]
13    journal_path: PathBuf,
14}
15
16impl CliCommand for CmdJournalInspect {
17    type Output = ();
18
19    fn run(self) -> Result<(), anyhow::Error> {
20        let journal = LogFileJournal::new(self.journal_path)?;
21        let printer = PrintingJournal::default();
22        copy_journal(&journal, &printer)?;
23        Ok(())
24    }
25}