Generate command line interfaces to your AIP gRPC services.
$ GOBIN=$PWD/build go install go.einride.tech/aip-cli/cmd/protoc-gen-go-aip-cli
The following example uses a buf generate template to configure the CLI generator.
version: v1
managed:
enabled: true
go_package_prefix:
default: go.einride.tech/aip-cli/cmd/examplectl
except:
- buf.build/googleapis/googleapis
plugins:
# The CLI generator requires the stubs generated by protoc-gen-go.
- name: go
out: cmd/examplectl
opt: module=go.einride.tech/aip-cli/cmd/examplectl
# The CLI generator optionally generates a root command and a main file
# to the root of the output module.
- name: go-aip-cli
out: cmd/examplectl
strategy: all
opt:
- module=go.einride.tech/aip-cli/cmd/examplectl
- root=examplectl
- gcloud_identity_tokens=true
$ buf generate \
--template buf.gen.example.yaml \
--path einride/example/freight
$ go install ./cmd/examplectl
$ examplectl help freight
this api represents a simple freight service
Usage:
examplectl freight [command]
Available Commands:
batch-get-sites batch get sites
create-shipment create a shipment
create-shipper create a shipper
create-site create a site
delete-shipment delete a shipment
delete-shipper delete a shipper
delete-site delete a site
get-shipment get a shipment
get-shipper get a shipper
get-site get a site
list-shipments list shipments for a shipper
list-shippers list shippers
list-sites list sites for a shipper
update-shipment update a shipment
update-shipper update a shipper
update-site update a site
Flags:
-h, --help help for freight
Global Flags:
--address string address to connect to
--insecure make insecure client connection (only on localhost)
--token string bearer token used by client
-v, --verbose print verbose output
Use "examplectl freight [command] --help" for more information about a command.