cliclient

package
v0.106.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cliclient 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

This section is empty.

Types

type CLIClient

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

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

func (*CLIClient) FetchAndOutput

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

func (*CLIClient) OutputObject

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

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

func (*CLIClient) PromptForAttributes

func (c *CLIClient) PromptForAttributes() (attributes []models.Attribute, err error)

func (*CLIClient) PromptForTags

func (c *CLIClient) PromptForTags() (tags []models.Tag, err error)

Jump to

Keyboard shortcuts

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