Skip to content

Commit 2008cc9

Browse files
committed
README
1 parent 610ef79 commit 2008cc9

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,36 +68,33 @@ To compile PureScript .purs files from .proto files, run for example:
6868
We can test out code generation immediately by
6969
generating `.purs` files for any of Google’s built-in “well-known types” in the
7070
[`google.protobuf`](https://protobuf.dev/reference/protobuf/google.protobuf/) package namespace. Try the command
71-
```console
71+
```shell
7272
protoc --purescript_out=. google/protobuf/any.proto
7373
```
7474
or
75-
```console
75+
```shell
7676
protoc --purescript_out=. google/protobuf/timestamp.proto
7777
```
7878

7979
To see
8080
[all of the `.proto` definitions](https://github.com/protocolbuffers/protobuf/tree/main/src/google/protobuf)
8181
included with the Nix PureScript Protobuf installation including
8282
the “well-known types,”
83-
```console
83+
```shell
8484
ls $(nix path-info .#protobuf)/src/google/protobuf/*.proto
8585
```
8686
8787
If you don't want to use Nix,
8888
1. install the PureScript toolchain and `protoc`.
8989
2. Build the [PureScript plugin for `protoc`](plugin/).
9090
3. Run `protoc` with the path to the PureScript plugin executable, like for example
91-
```console
91+
```shell
9292
protoc --plugin=bin/protoc-gen-purescript --purescript_out=. google/protobuf/timestamp.proto
9393
```
9494
9595
## Writing programs with the generated code
9696
97-
The code generator will use the `package` import statement in the `.proto` file
98-
and the base `.proto` file name as the PureScript module name for that file.
99-
100-
A message in a `shapes.proto` descriptor file declared as
97+
Suppose we have a `Rectangle` message declared in a `shapes.proto` descriptor file:
10198
10299
```
103100
syntax = "proto3";
@@ -109,8 +106,19 @@ message Rectangle {
109106
}
110107
```
111108
112-
will export these four names from module `Interproc.Shapes` in a
113-
generated `shapes.Interproc.purs` file.
109+
We run
110+
111+
```shell
112+
protoc --purescript_out=. shapes.proto
113+
```
114+
115+
which will generate a file `shapes.Interproc.purs`.
116+
117+
The code generator will use the `package` import statement in the `.proto` file
118+
and the base `.proto` file name as the PureScript module name for that file.
119+
120+
The generated `shapes.Interproc.purs` file
121+
will export these four names from module `Interproc.Shapes`.
114122
115123
1. A message data type.
116124
@@ -258,12 +266,12 @@ programs which use code generated by __protobuf__. Refer to these
258266
for further examples of how to use the generated code.
259267
260268
1. The `protoc`
261-
[compiler plugin](https://github.com/xc-jp/purescript-protobuf/blob/master/plugin/src/Main.purs).
269+
[compiler plugin](https://github.com/rowtype-yoga/purescript-protobuf/blob/master/plugin/src/Main.purs).
262270
The code generator imports generated code. This program writes itself.
263271
2. The
264-
[unit test suite](https://github.com/xc-jp/purescript-protobuf/blob/master/library/test/Main.purs)
272+
[unit test suite](https://github.com/rowtype-yoga/purescript-protobuf/blob/master/plugin/test/Test/Main.purs).
265273
3. The Google
266-
[conformance test program](https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/src/Main.purs)
274+
[conformance test program](https://github.com/xc-jp/purescript-protobuf/blob/master/conformance/src/Main.purs).
267275
268276
The [Protobuf Decoder Explainer](http://jamesdbrock.github.io/protobuf-decoder-explainer/) shows an
269277
example of how to use this library to parse binary Protobuf when we don’t

0 commit comments

Comments
 (0)