Skip to content

Commit

Permalink
feat (cli): Add BinaryPB output --format
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Oct 1, 2023
1 parent ca8ba60 commit 71d8a05
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/src/main/java/dev/enola/cli/Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public enum Format {

YAML,

JSON;
JSON,

BinaryPB;

MediaType toMediaType() {
switch (this) {
Expand All @@ -36,6 +38,8 @@ MediaType toMediaType() {
return ProtobufMediaTypes.PROTOBUF_YAML_UTF_8;
case JSON:
return ProtobufMediaTypes.PROTOBUF_JSON_UTF_8;
case BinaryPB:
return ProtobufMediaTypes.PROTOBUF_BINARY;
default:
throw new IllegalStateException();
}
Expand Down
15 changes: 15 additions & 0 deletions cli/src/test/java/dev/enola/cli/EnolaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ public void get() {
+ " paths: \"helo\"\n");
}

@Test
public void getBinary() {
var exec =
cli(
"-v",
"get",
"--format",
"BinaryPB",
"--model",
"classpath:cli-test-model.textproto",
"test.foobar/helo");
assertThat(exec).err().isEmpty();
assertThat(exec).hasExitCode(0);
}

@Test
public void serveBothHttpAndGRPC() {
var exec =
Expand Down

0 comments on commit 71d8a05

Please sign in to comment.