cli

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Package cli provides boilerplate code required to generate plugin executable. At high level it performs following tasks 1. Validate command arguments 2. Read and unmarshal input 3. Execute relevant plugin functions 4. marshals output

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI struct is used to create an executable for plugin.

func New

func New(pl plugin.Plugin) (*CLI, error)

New creates a new CLI using given plugin

func NewWithLogger

func NewWithLogger(pl plugin.Plugin, l log.Logger) (*CLI, error)

NewWithLogger creates a new CLI using given plugin and logger

func (*CLI) Execute

func (c *CLI) Execute(ctx context.Context, args []string)

Execute is main controller that reads/validates commands, parses input, executes relevant plugin functions and returns corresponding output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL