Skip to content

Commit

Permalink
[petanque] Add TCP/IP pet-server
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdrt committed May 13, 2024
1 parent 28fcbc1 commit c7314de
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
44 changes: 44 additions & 0 deletions petanque/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,47 @@ Please use one line per json input. json input examples are:

Seems to work! (TM) (Famous last words)

## Running `pet-server`

After building Petanque, you can launch a TCP server with:
```
dune exec -- pet-server
```

Default address is 127.0.0.1 and default port is 8765.

```
❯ dune exec -- pet-server --help
PET(1) Pet Manual PET(1)
NAME
pet - Petanque Server
SYNOPSIS
pet [--address=ADDRESS] [--backlog=BACKLOG] [--port=PORT] [OPTION]…
DESCRIPTION
Launch a petanque server to interact with Coq
USAGE
See the documentation on the project's webpage for more information
OPTIONS
-a ADDRESS, --address=ADDRESS (absent=127.0.0.1)
address to listen to
-b BACKLOG, --backlog=BACKLOG (absent=10)
socket backlog
-p PORT, --port=PORT (absent=8765)
port to listen to
COMMON OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
--version
Show version information.
```
22 changes: 17 additions & 5 deletions petanque/json_shell/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
(executable
(name pet)
(public_name pet)
(modules :standard)
(library
(name petanque_json)
(public_name coq-lsp.petanque.json)
(modules :standard \ pet server)
(preprocess
(staged_pps ppx_import ppx_deriving_yojson))
(libraries cmdliner lsp petanque))
(libraries petanque lsp))

(executables
(names pet)
(public_names pet)
(modules pet)
(libraries cmdliner petanque_json))

(executables
(names server)
(public_names pet-server)
(modules server)
(libraries logs.lwt lwt.unix petanque_json))
2 changes: 2 additions & 0 deletions petanque/json_shell/pet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ let pet_main debug roots =
in
loop ~token

open Cmdliner

let pet_cmd : unit Cmd.t =
let doc = "Petanque Coq Environment" in
let man =
Expand Down

0 comments on commit c7314de

Please sign in to comment.