Skip to content

Commit

Permalink
chore: Update help message
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Sep 19, 2023
1 parent 5d9897e commit cf4a09f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protoc --jsonschema_out=. *.proto
protoc --jsonschema_out=. --jsonschema_opt=output_file_suffix=.yaml *.proto
```

#### Shrink bytes for transfer over network.
#### Shrink bytes for transfer over network
```
protoc --jsonschema_out=. --jsonschema_opt=pretty_json_output=false
```
Expand Down
27 changes: 25 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,36 @@ import (

var version string = "develop"

const helpMessage = `Usage protoc-gen-jsonschema:
protoc --jsonschema_out=. (OPTIONS) *.proto
This plugin converts 'protocol buffer' formats to 'json-schema'. Support json-schema 'draft-04, draft-06, draft-07, draft-2019-09, draft-2020-12' versions.
EXAMPLE: I'm not sure which options to use
protoc --jsonschema_out=. *.proto
EXAMPLE: Generate with yaml format
protoc --jsonschema_out=. --jsonschema_opt=output_file_suffix=.yaml *.proto
EXAMPLE: Shrink bytes for transfer over network
protoc --jsonschema_out=. --jsonschema_opt=pretty_json_output=false
EXAMPLE: I'd like to comply with the protobuf JSON mapping standard
protoc --jsonschema_out=. --jsonschema_opt=int64_as_string=true
Please check https://github.com/pubg/protoc-gen-jsonschema for more details.
FLAGS:
--version : print version
--help : print help
`

func main() {
if len(os.Args) == 2 {
if os.Args[1] == "--version" {
fmt.Println(version)
} else if os.Args[1] == "--help" {
fmt.Println("USAGE:")
fmt.Println(" protoc-gen-jsonschema --version : print version")
fmt.Print(helpMessage)
}
return
}
Expand Down

0 comments on commit cf4a09f

Please sign in to comment.