Skip to content
πŸ’ Package ctl enables drop-in gRPC client integration for your service into command-line applications
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
ctl.go
props.go

README.md

ctl

Package ctl provides a library that makes it easy to embed a simple, minimal client into your Go program to interact with your gRPC server.

Usage

API is still WIP and subject to change, but here's the general gist:

import "github.com/bobheadxi/ctl"

func main() {
  // instantiate your gRPC client
  c, _ := client.New( /* ... */ )

  // create a controller
  controller, _ := ctl.New(c)

  // show help if you want
  if os.Args != nil && len(os.Args) == 1 && os.Args[0] == "help" {
    controller.Help(os.Stdout)
    return
  }

  // execute command
  out, _ := controller.Exec(os.Args[0:], os.Stdout)

  // print the output
  fmt.Printf("%v\n", out)
}

In a command line application, you can then run:

$> my-command SomeRPCCall RequestParam=blah AnotherRequestParam=wow
You can’t perform that action at this time.