-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from lefessan/z-2023-03-14-fixes
Multiple fixes after testing on autofonce
- Loading branch information
Showing
5 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* Copyright 2020 OCamlPro & Origin Labs *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of the *) | ||
(* GNU Lesser General Public License version 2.1, with the special *) | ||
(* exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
open Ezcmd.V2 | ||
open EZCMD.TYPES | ||
|
||
let cmd_name = "toml" | ||
|
||
let parse_and_print file = | ||
match Drom_toml.Parser.from_filename file with | ||
| `Ok toml -> | ||
let s = Drom_toml.Printer.string_of_table toml in | ||
Printf.printf "%s%!" s | ||
| `Error (s, loc) -> | ||
Error.raise "Could not parse file: %s at %s" s | ||
(EzToml.string_of_location loc) | ||
|
||
let cmd = | ||
EZCMD.sub cmd_name | ||
(fun () -> ()) | ||
~args:[ | ||
[], Arg.Anons (fun files -> | ||
List.iter parse_and_print files | ||
), | ||
EZCMD.info ~docv:"FILE" | ||
"Parse FILE and write it back on stdout" | ||
] | ||
~doc:"Read TOML files and print them back on stdout" | ||
~man: | ||
[ `S "DESCRIPTION"; | ||
`Blocks | ||
[ `P "Test the TOML parser/printer:" ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters