neo-decompiler 0.10.2

Neo N3 NEF decompiler: parse, disassemble, lift bytecode to high-level pseudocode and C# skeletons, with a CLI, JSON reports, and optional WebAssembly bindings.
Documentation
use std::path::Path;

use crate::error::Result;
use crate::nef::NefParser;

use super::super::args::{Cli, InfoFormat};

mod json;
mod text;

impl Cli {
    pub(super) fn run_info(&self, path: &Path, format: InfoFormat) -> Result<()> {
        let data = Self::read_nef_bytes(path)?;
        let parse_output = NefParser::new().parse_with_warnings(&data)?;
        let nef = parse_output.nef;
        let warnings = parse_output
            .warnings
            .iter()
            .map(ToString::to_string)
            .collect::<Vec<_>>();
        let manifest = self.load_manifest(path)?;
        let manifest_path = self.resolve_manifest_path(path);

        match format {
            InfoFormat::Text => self.print_info_text(
                path,
                &nef,
                manifest.as_ref(),
                manifest_path.as_ref(),
                &warnings,
            ),
            InfoFormat::Json => self.print_info_json(
                path,
                &nef,
                manifest.as_ref(),
                manifest_path.as_ref(),
                &warnings,
            ),
        }
    }
}