Documentation ¶
Index ¶
- Variables
- func Connect2gRPC(c *cli.Context) (*grpc.ClientConn, error)
- func GenerateAction(ctx context.Context, output OutputMessage, newGrpcClient interface{}, ...) func(*cli.Context) error
- func GenerateFlags(targetGRPC interface{}, argsKeys []string) []cli.Flag
- func GenerateGRPCGetter(f interface{}, argsKeys []string, newGrpcClient interface{}) ...
- func ParseJsonTag(tag string) string
- func PrintGrpcError(err error)
- type OutputMessage
- type Outputter
- func (o Outputter) GenerateOutputMethod(tableKeys []string) OutputMessage
- func (o Outputter) OutputJson(m proto.Message) error
- func (o Outputter) OutputJsonAsOutputMessage(c *cli.Context, m proto.Message) error
- func (o Outputter) OutputNone(c *cli.Context, m proto.Message) error
- func (o Outputter) OutputTable(m proto.Message, keys []string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var API_URL_FLAG = cli.StringFlag{
Name: "api-url",
Value: "grpc://localhost:20180",
EnvVar: "N0CLI_API_URL",
}
View Source
var OUTPUT_TYPE_FLAG = cli.StringFlag{
Name: "output, o",
Value: "table",
Usage: "Select a output method from `table,json`",
}
Functions ¶
func Connect2gRPC ¶
func Connect2gRPC(c *cli.Context) (*grpc.ClientConn, error)
func GenerateAction ¶
func GenerateFlags ¶
"name" is standard field, so get by args
func GenerateGRPCGetter ¶
func GenerateGRPCGetter(f interface{}, argsKeys []string, newGrpcClient interface{}) func(c *cli.Context, ctx context.Context, conn *grpc.ClientConn) (proto.Message, error)
this function panic when set an argument that is not gRPC method.
func ParseJsonTag ¶
func PrintGrpcError ¶
func PrintGrpcError(err error)
Types ¶
type Outputter ¶
func DefaultOutputer ¶
func DefaultOutputer() *Outputter
func (Outputter) GenerateOutputMethod ¶
func (o Outputter) GenerateOutputMethod(tableKeys []string) OutputMessage
func (Outputter) OutputJsonAsOutputMessage ¶
Click to show internal directories.
Click to hide internal directories.