Skip to content

Commit 643cd14

Browse files
committed
Prolog CLI: Use filename instead of stream(user_input)
1 parent 39d9774 commit 643cd14

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

lib-pl/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ All you need is [SWI-Prolog](http://www.swi-prolog.org/). See there for installa
88

99
## Usage
1010

11-
`xsd2json` provides a command line interface. You can use it via
11+
`xsd2json` provides a command line interface. You can directly execute it via
1212

13-
swipl -q -f cli.pl -- < /path/to/your.xsd
13+
./cli /path/to/your.xsd
14+
15+
or by calling swipl:
16+
17+
swipl -q -f cli /path/to/your.xsd
1418

1519
Unfortunately the command line version is way slower than using `xsd2json` programmatically. The `xsd2json.pl` module provides a predicate `xsd2json/2` which can be used to convert a given XSD file into the equivalent JSON Schema. Call it via `swipl -s xsd2json.pl` followed by
1620

lib-pl/cli

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/swipl -f -q
2+
3+
:- use_module(xsd2json).
4+
:- use_module(library(http/json)).
5+
6+
7+
:- initialization main.
8+
9+
main :-
10+
current_prolog_flag(argv, Argv),
11+
Argv = [Filename|_],
12+
xsd2json(Filename,JSON),
13+
json_write(user_output,JSON),
14+
halt(0).

lib-pl/cli.pl

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)