1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
(* SPDX-License-Identifier: AGPL-3.0-or-later *)
(* Copyright © 2021-2024 OCamlPro *)
(* Written by the Owi programmers *)

open Syntax

let cmd_one file =
  let ext = Fpath.get_ext file in
  match ext with
  | ".wasm" ->
    let* m = Parse.Binary.Module.from_file file in
    let m = Binary_to_text.modul m in
    Ok (Format.pp_std "%a@\n" Text.pp_modul m)
  | ext -> Error (`Msg (Format.sprintf "invalid extension: `%s`" ext))

let cmd files = list_iter cmd_one files