formatter

package
v0.0.0-...-3abe282 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatApiKey

func FormatApiKey(key *models.APIKey, opt string) string

FormatApiKey formats an api key and displays it with the request format option.

func FormatApiKeys

func FormatApiKeys(keys []*models.APIKey, opt string) string

FormatApiKeys formats a list of api keys and displays it with the requested format option.

func FormatCommand

func FormatCommand(command *models.Command, opt string) string

FormatCommand formats a command and displays it with the request format option.

func FormatCommandRun

func FormatCommandRun(run *models.CommandRun, opt string) string

FormatCommandRun formats a command run and displays it with the request format option.

func FormatCommands

func FormatCommands(commands []*models.Command, opt string) string

FormatCommands formats a list of commands and displays it with the requested format option.

func FormatCreatedApiKey

func FormatCreatedApiKey(key *models.APIKey, opt string) string

FormatCreatedApiKey formats an api key and displays it with the request format option including the generated random secret.

func FormatEvent

func FormatEvent(event *models.Event, opt string) string

FormatEvent formats a event and displays it with the request format option.

func FormatEvents

func FormatEvents(events []*models.Event, opt string) string

FormatEvents formats a list of events and displays it with the requested format option.

func FormatPlatforms

func FormatPlatforms(platforms []models.Platform, opt string) string

FormatPlatforms formats a list of platforms and displays it with the requested format option.

func FormatRepositories

func FormatRepositories(repos []*models.Repository, opt string) string

FormatRepositories formats a list of repositories and displays it with the requested format option.

func FormatRepository

func FormatRepository(repo *models.Repository, opt string) string

FormatRepository formats a repository and displays it with the request format option.

func FormatSetting

func FormatSetting(setting *models.CommandSetting, opt string) string

FormatSetting formats a setting and displays it with the request format option.

func FormatSettings

func FormatSettings(settings []*models.CommandSetting, opt string) string

FormatSettings formats a list of settings and displays it with the request format option.

func FormatUser

func FormatUser(user *models.User, opt string) string

FormatUser formats a user and displays it with the request format option.

func FormatUsers

func FormatUsers(users []*models.User, opt string) string

FormatUsers formats a list of users and displays it with the requested format option.

func FormatVaultSecret

func FormatVaultSecret(secret *models.VaultSetting, opt string) string

FormatVaultSecret formats a single object of vault secret and displays it with the requested format option.

func FormatVaultSecrets

func FormatVaultSecrets(secrets []string, opt string) string

FormatVaultSecrets formats a list of vault secrets and displays it with the requested format option.

Types

type Formatter

type Formatter interface {
	FormatObject(data []kv) string
	FormatList(data [][]kv) string
}

Formatter defines a formatter for the returned data. JSON or Table are supported for now.

func NewFormatter

func NewFormatter(opt string) Formatter

NewFormatter creates a formatter based on a set argument.

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter takes a raw data and formats it as JSON data

func (*JSONFormatter) FormatList

func (j *JSONFormatter) FormatList(data [][]kv) string

FormatList formats a list of key value objects as JSON.

func (*JSONFormatter) FormatObject

func (j *JSONFormatter) FormatObject(data []kv) string

FormatObject formats a key value list as JSON.

type TableFormatter

type TableFormatter struct{}

TableFormatter formats data as table entries.

func (*TableFormatter) FormatList

func (t *TableFormatter) FormatList(data [][]kv) string

FormatList formats a list of key value objects as Table.

func (*TableFormatter) FormatObject

func (t *TableFormatter) FormatObject(data []kv) string

FormatObject formats a key value list as Table.

Jump to

Keyboard shortcuts

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