utils

package
v0.0.0-...-ef817f9 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Success prints text in green
	Success = color.New(color.FgGreen).SprintFunc()
	// Error prints text in red
	Error = color.New(color.FgRed).SprintFunc()
	// Warning prints text in yellow
	Warning = color.New(color.FgYellow).SprintFunc()
	// Info prints text in bright white (for better readability on dark backgrounds)
	Info = color.New(color.FgHiGreen).SprintFunc()
	// Bold prints text in bold
	Bold = color.New(color.Bold).SprintFunc()
	// Heading prints text in cyan and bold
	Heading = color.New(color.FgCyan, color.Bold).SprintFunc()
	// Cyan prints text in cyan
	Cyan = color.New(color.FgCyan).SprintFunc()
	// Gray prints text in gray
	Gray = color.New(color.FgHiBlack).SprintFunc()
	// White prints text in white
	White = color.New(color.FgWhite).SprintFunc()
)
View Source
var ColoredHelpTemplate = `` /* 926-byte string literal not displayed */

ColoredHelpTemplate is a custom help template with color formatting

Functions

func APIBaseURL

func APIBaseURL(raw string) string

APIBaseURL returns the base URL for Synkronus HTTP API routes in openapi/synkronus.yaml, which are all under the /api prefix from the deployment origin. If the configured URL already ends with /api, it is left unchanged so paths are not doubled.

func EnsureScheme

func EnsureScheme(raw string) string

EnsureScheme prepends https:// to the URL if it has no scheme (http:// or https://). Used so users can set api.url to "misha.synkronus.cloud" and the CLI still works.

func ErrorIcon

func ErrorIcon() string

ErrorIcon returns a red X

func FormatKeyValue

func FormatKeyValue(key string, value interface{}) string

FormatKeyValue formats a key-value pair with the key in bold

func InfoIcon

func InfoIcon() string

InfoIcon returns a blue information mark

func NormalizeURL

func NormalizeURL(raw string) string

NormalizeURL trims trailing slashes from a URL string (after EnsureScheme).

func OriginURL

func OriginURL(raw string) string

OriginURL strips a trailing /api segment (case-insensitive) so callers can reach routes served at the site root, e.g. GET /health in the OpenAPI spec.

func PrintError

func PrintError(format string, a ...interface{})

PrintError prints an error message with a red X

func PrintHeading

func PrintHeading(format string, a ...interface{})

PrintHeading prints a heading in cyan and bold

func PrintInfo

func PrintInfo(format string, a ...interface{})

PrintInfo prints an info message with a blue information mark

func PrintSuccess

func PrintSuccess(format string, a ...interface{})

PrintSuccess prints a success message with a green checkmark

func PrintWarning

func PrintWarning(format string, a ...interface{})

PrintWarning prints a warning message with a yellow exclamation mark

func SetupColoredHelp

func SetupColoredHelp(rootCmd *cobra.Command)

SetupColoredHelp configures the command to use the colored help template

func SuccessIcon

func SuccessIcon() string

SuccessIcon returns a green checkmark

func WarningIcon

func WarningIcon() string

WarningIcon returns a yellow exclamation mark

Types

This section is empty.

Jump to

Keyboard shortcuts

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