Documentation ¶
Index ¶
- Constants
- Variables
- func Errorf(format string, a ...interface{})
- func Errorln(a ...interface{})
- func Infof(format string, a ...interface{})
- func Infoln(a ...interface{})
- func InputCloudToken(serverUrl string) (string, *schema.Diagnostics)
- func PrintDiagnostic(diagnostics []*schema.Diagnostic) error
- func PrintDiagnostics(diagnostics *schema.Diagnostics) error
- func Printf(c *color.Color, format string, a ...any)
- func Println(c *color.Color, a ...any)
- func SDKLogLevelToCliLevel(level schema.DiagnosticLevel) hclog.Level
- func SaveLogToDiagnostic(diagnostics []*schema.Diagnostic)
- func SelectProviders(providers []string, title ...string) map[string]struct{}
- func ShowDesc(bar *Bar, wcc ...decor.WC) decor.Decorator
- func ShowLoginFailed(cloudToken string)
- func ShowLoginSuccess(serverUrl string, cloudCredentials *cloud_sdk.CloudCredentials)
- func ShowLogout(cloudCredentials *cloud_sdk.CloudCredentials)
- func ShowRetrievedCloudCredentials(cloudCredentials *cloud_sdk.CloudCredentials)
- func ShowRows(tableHeader []string, tableBodyMatrix [][]string, tableFooter []string, ...)
- func ShowTable(tableHeader []string, tableBody [][]string, tableFooter []string, ...)
- func Successf(format string, a ...interface{})
- func Successln(a ...interface{})
- func Warningf(format string, a ...interface{})
- func Warningln(a ...interface{})
- type Bar
- type LogJSON
- type Progress
- func (p *Progress) Add(name string, total int64)
- func (p *Progress) Current(name string, n int64, desc ...string)
- func (p *Progress) Done(name string)
- func (p *Progress) IOBar(name string, reader io.Reader, total int64)
- func (p *Progress) Increment(name string, n int64)
- func (p *Progress) Next(name string)
- func (p *Progress) SetTotal(name string, n int64)
- func (p *Progress) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
- func (p *Progress) Wait(name string)
Examples ¶
Constants ¶
const CloudTokenRequestPath = "/Settings/accessTokens"
CloudTokenRequestPath What is the request path to obtain the cloud token If there is a change in the address of the cloud side, synchronize it here
const DefaultSelectProvidersTitle = "[ Use arrows to move, Space to select, Enter to complete the selection ]"
Variables ¶
var ( YellowColor = color.New(color.FgYellow).SprintFunc() RedColor = color.New(color.FgRed).SprintFunc() GreenColor = color.New(color.FgGreen).SprintFunc() BlueColor = color.New(color.FgBlue).SprintFunc() MagentaColor = color.New(color.FgMagenta).SprintFunc() BlackColor = color.New(color.FgBlack).SprintFunc() CyanColor = color.New(color.FgCyan).SprintFunc() WhiteColor = color.New(color.FgWhite).SprintFunc() )
Functions ¶
func InputCloudToken ¶
func InputCloudToken(serverUrl string) (string, *schema.Diagnostics)
InputCloudToken Guide the user to enter a cloud token
func PrintDiagnostic ¶
func PrintDiagnostic(diagnostics []*schema.Diagnostic) error
func PrintDiagnostics ¶
func PrintDiagnostics(diagnostics *schema.Diagnostics) error
func SDKLogLevelToCliLevel ¶ added in v0.0.19
func SDKLogLevelToCliLevel(level schema.DiagnosticLevel) hclog.Level
func SaveLogToDiagnostic ¶
func SaveLogToDiagnostic(diagnostics []*schema.Diagnostic)
func SelectProviders ¶
SelectProviders Give a list of providers and let the user select some of them Does the installation sequence have to be consistent with the selected sequence? Temporarily, I think it can be inconsistent
func ShowLoginFailed ¶
func ShowLoginFailed(cloudToken string)
ShowLoginFailed Displays a login failure message
func ShowLoginSuccess ¶
func ShowLoginSuccess(serverUrl string, cloudCredentials *cloud_sdk.CloudCredentials)
ShowLoginSuccess The CLI prompt indicating successful login is displayed
func ShowLogout ¶
func ShowLogout(cloudCredentials *cloud_sdk.CloudCredentials)
ShowLogout Display the logout success prompt
func ShowRetrievedCloudCredentials ¶
func ShowRetrievedCloudCredentials(cloudCredentials *cloud_sdk.CloudCredentials)
ShowRetrievedCloudCredentials Displays the results of the local retrieval of login credentials
func ShowRows ¶
func ShowRows(tableHeader []string, tableBodyMatrix [][]string, tableFooter []string, setBorder bool)
ShowRows Display the table on the console TODO refactor function
Example ¶
tableHeader := []string{ "id", "name", "age", } tableBody := [][]string{ { "1", "Tom", "18", }, { "2", "Ada", "26", }, { "3", "Sam", "30", }, } tableFooter := []string{ "footer1", "footer2", "footer", } setBorder := true ShowRows(tableHeader, tableBody, tableFooter, setBorder)
Output: *********** Row 0 ********** id: 1 name: Tom age: 18 *********** Row 1 ********** id: 2 name: Ada age: 26 *********** Row 2 ********** id: 3 name: Sam age: 30
func ShowTable ¶
ShowTable Shows which tables are currently available
Example ¶
tableHeader := []string{ "id", "name", "age", } tableBody := [][]string{ { "1", "Tom", "18", }, { "2", "Ada", "26", }, { "3", "Sam", "30", }, } tableFooter := []string{ "footer1", "footer2", "footer", } setBorder := true ShowTable(tableHeader, tableBody, tableFooter, setBorder)
Output: +---------+---------+--------+ | ID | NAME | AGE | +---------+---------+--------+ | 1 | Tom | 18 | | 2 | Ada | 26 | | 3 | Sam | 30 | +---------+---------+--------+ | FOOTER1 | FOOTER2 | FOOTER | +---------+---------+--------+
Types ¶
type Bar ¶
type Bar struct { Name string Desc string Start time.Time Current time.Time // contains filtered or unexported fields }
Bar represents a progress bar
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress is a progress object
func DefaultProgress ¶
func DefaultProgress() *Progress
DefaultProgress creates a new progress object
func (*Progress) TrackProgress ¶
func (p *Progress) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)