cli

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cli provides a client SDK for outputting data to a terminal in multiple formats

Index

Constants

View Source
const (
	OutputStyleJSON       = "json"
	OutputStyleJSONPretty = "json_pretty"
	OutputStyleTabby      = "tabby" // Default
)

Variables

This section is empty.

Functions

func FetchAndOutput deprecated added in v0.36.0

func FetchAndOutput(f func() (models.TabbyPrinter, error)) error

Deprecated: Use (*CLIClient).FetchAndOutput instead

Types

type CLIClient added in v0.58.0

type CLIClient struct {
	APIClient    *apiclient.APIClient
	OutputStyle  string
	TabbyHeaders []string
}

func New

func New(client *http.Client, host, key string, port int, protocol, outputStyle string) (*CLIClient, error)

func NewFromViper added in v0.58.0

func NewFromViper(client *http.Client) (*CLIClient, error)

func (*CLIClient) FetchAndOutput added in v0.60.0

func (c *CLIClient) FetchAndOutput(f func() (apiresponse.TabbyPrinter, error)) error

func (*CLIClient) OutputObject added in v0.58.0

func (c *CLIClient) OutputObject(tabby_printer apiresponse.TabbyPrinter) error

OutputObject prints indented or unindented json, or an ascii table (tabby) (depending on *CLIClient#OutputStyle) to stdout

func (*CLIClient) PromptForAttribute added in v0.58.0

func (c *CLIClient) PromptForAttribute() (models.Attribute, error)

type Client deprecated

type Client struct {
	TabbyHeaders []string // e.g. ["id", "name"]
}

Deprecated: Use CLIClient instead

func NewCliClient deprecated added in v0.31.0

func NewCliClient(outputStyle string) (*Client, error)

Deprecated: Use New instead

func NewCliClientFromViper deprecated added in v0.50.2

func NewCliClientFromViper() (*Client, error)

Deprecated: Use NewFromViper instead

func (*Client) OutputObject deprecated

func (c *Client) OutputObject(tabby_printer models.TabbyPrinter) error

Deprecated: Use (*CLIClient).OutputObject instead

OutputObject prints indented or unindented json, or an ascii table (tabby) (depending on *Client#OutputStyle) to stdout

func (Client) PromptForAttribute deprecated added in v0.48.1

func (c Client) PromptForAttribute(apiClient *api.ApiClient) (models.Attribute, error)

Deprecated: Use (*CLIClient).PromptForAttribute instead

Jump to

Keyboard shortcuts

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