Skip to content

Commit d99328f

Browse files
committed
Rename example binaries
1 parent c5376dd commit d99328f

File tree

6 files changed

+32
-20
lines changed

6 files changed

+32
-20
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
cover.out
55

66
/cmd/protoc-gen-pluginrpc-go/protoc-gen-pluginrpc-go
7-
/internal/example/cmd/pluginrpc-example-client-error/pluginrpc-example-client-error
8-
/internal/example/cmd/pluginrpc-example-client-list/pluginrpc-example-client-list
9-
/internal/example/cmd/pluginrpc-example-client-request/pluginrpc-example-client-request
10-
/internal/example/cmd/pluginrpc-example-server/pluginrpc-example-server
7+
/internal/example/cmd/example-client-echo-error/example-client-echo-error
8+
/internal/example/cmd/example-client-echo-list/example-client-echo-list
9+
/internal/example/cmd/example-client-echo-request/example-client-echo-request
10+
/internal/example/cmd/example-plugin/example-plugin

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ For a full example, see the [internal/example](internal/example) directory. This
2121
package that contains an example Protobuf service `EchoService`.
2222
- [gen/pluginrpc/example/v1](internal/example/gen/pluginrpc/example/v1): The generated code
2323
from `protoc-gen-go` and `protoc-gen-pluginrpc-go` for the example Protobuf Package.
24-
- [pluginrpc-example-server](internal/example/cmd/pluginrpc-example-server): An implementation of a
24+
- [example-plugin](internal/example/cmd/example-plugin): An implementation of a
2525
PluginRPC plugin for `EchoService`.
26-
- [pluginrpc-example-client-request](internal/example/cmd/pluginrpc-example-client-request): A
27-
simple client that calls the `EchoRequest` RPC via invoking `pluginrpc-example-server`.
28-
- [pluginrpc-example-client-list](internal/example/cmd/pluginrpc-example-client-request): A simple
29-
client that calls the `EchoList` RPC via invoking `pluginrpc-example-server`.
30-
- [pluginrpc-example-client-error](internal/example/cmd/pluginrpc-example-client-error): A simple
31-
client that calls the `EchoError` RPC via invoking `pluginrpc-example-server`.
26+
- [example-client-echo-request](internal/example/cmd/example-client-echo-request): A
27+
simple client that calls the `EchoRequest` RPC via invoking `example-plugin`.
28+
- [example-client-echo-list](internal/example/cmd/example-client-echo-request): A simple
29+
client that calls the `EchoList` RPC via invoking `example-plugin`.
30+
- [example-client-echo-error](internal/example/cmd/example-client-echo-error): A simple
31+
client that calls the `EchoError` RPC via invoking `example-plugin`.
3232

3333
## Usage
3434

@@ -64,7 +64,7 @@ plugins:
6464
opt: paths=source_relative
6565
```
6666
67-
Build your plugin. See [pluginrpc-example-server](internal/example/cmd/pluginrpc-example-server) for
67+
Build your plugin. See [example-plugin](internal/example/cmd/example-plugin) for
6868
a full example. Assuming you intend to expose the `EchoService` as a plugin, your code will look
6969
something like this:
7070

@@ -76,6 +76,12 @@ func main() {
7676
func newServer() (pluginrpc.Server, error) {
7777
spec, err := examplev1pluginrpc.EchoServiceSpecBuilder{
7878
// Note that EchoList does not have optional args and will default to path being the only arg.
79+
//
80+
// This means that the following commands will invoke their respective procedures:
81+
//
82+
// example-plugin echo request
83+
// example-plugin /pluginrpc.example.v1.EchoService/EchoList
84+
// example-plugin echo error
7985
EchoRequest: []pluginrpc.ProcedureOption{pluginrpc.ProcedureWithArgs("echo", "request")},
8086
EchoError: []pluginrpc.ProcedureOption{pluginrpc.ProcedureWithArgs("echo", "error")},
8187
}.Build()
@@ -104,11 +110,11 @@ func (echoServiceHandler) EchoError(_ context.Context, request *examplev1.EchoEr
104110
```
105111

106112
Invoke your plugin. You'll create a client that points to your plugin. See
107-
[pluginrpc-example-client-request](internal/example/cmd/pluginrpc-example-client-request) for a full
113+
[example-client-echo-request](internal/example/cmd/example-client-echo-request) for a full
108114
example. Invocation will look something like this:
109115

110116
```go
111-
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("pluginrpc-example-server"))
117+
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("example-plugin"))
112118
echoServiceClient, err := examplev1pluginrpc.NewEchoServiceClient(client)
113119
if err != nil {
114120
return err

internal/example/cmd/pluginrpc-example-client-error/main.go renamed to internal/example/cmd/example-client-echo-error/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
// Package main implements a client that calls the EchoError RPC on the
16-
// pluginrpc-example-server plugin.
16+
// example-plugin plugin.
1717
//
1818
// This will parse the first arg as an error Code, and all further args will
1919
// comprise the error message.
@@ -41,7 +41,7 @@ func main() {
4141
}
4242

4343
func run() error {
44-
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("pluginrpc-example-server"))
44+
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("example-plugin"))
4545
echoServiceClient, err := examplev1pluginrpc.NewEchoServiceClient(client)
4646
if err != nil {
4747
return err

internal/example/cmd/pluginrpc-example-client-list/main.go renamed to internal/example/cmd/example-client-echo-list/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
// Package main implements a client that calls the EchoList RPC on the
16-
// pluginrpc-example-server plugin.
16+
// example-plugin plugin.
1717
//
1818
// This will echo the list produded by EchoList.
1919
package main
@@ -37,7 +37,7 @@ func main() {
3737
}
3838

3939
func run() error {
40-
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("pluginrpc-example-server"))
40+
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("example-plugin"))
4141
echoServiceClient, err := examplev1pluginrpc.NewEchoServiceClient(client)
4242
if err != nil {
4343
return err

internal/example/cmd/pluginrpc-example-client-request/main.go renamed to internal/example/cmd/example-client-echo-request/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
// Package main implements a client that calls the EchoRequest RPC on the
16-
// pluginrpc-example-server plugin.
16+
// example-plugin plugin.
1717
//
1818
// This will echo back any args given to this client.
1919
package main
@@ -38,7 +38,7 @@ func main() {
3838
}
3939

4040
func run() error {
41-
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("pluginrpc-example-server"))
41+
client := pluginrpc.NewClient(pluginrpc.NewExecRunner("example-plugin"))
4242
echoServiceClient, err := examplev1pluginrpc.NewEchoServiceClient(client)
4343
if err != nil {
4444
return err

internal/example/cmd/pluginrpc-example-server/main.go renamed to internal/example/cmd/example-plugin/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ func main() {
3434
func newServer() (pluginrpc.Server, error) {
3535
spec, err := examplev1pluginrpc.EchoServiceSpecBuilder{
3636
// Note that EchoList does not have optional args and will default to path being the only arg.
37+
//
38+
// This means that the following commands will invoke their respective procedures:
39+
//
40+
// example-plugin echo request
41+
// example-plugin /pluginrpc.example.v1.EchoService/EchoList
42+
// example-plugin echo error
3743
EchoRequest: []pluginrpc.ProcedureOption{pluginrpc.ProcedureWithArgs("echo", "request")},
3844
EchoError: []pluginrpc.ProcedureOption{pluginrpc.ProcedureWithArgs("echo", "error")},
3945
}.Build()

0 commit comments

Comments
 (0)