util

package
v0.10.2-beta Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GEAR      = "⚙"
	CHECK     = "✔"
	CANCEL    = "✘"
	INFO      = "ℹ"
	WARN      = "⚠"
	ERROR     = "✖"
	HOURGLASS = "⌛"
)
View Source
const (
	Bold   = "\033[1m"
	Reset  = "\033[0m"
	Green  = "\033[32m"
	Blue   = "\033[34m"
	Yellow = "\033[33m"
	Cyan   = "\033[36m"
	Red    = "\033[31m"
	Gray   = "\033[37;2m"
)

Initialize console colours

View Source
const (
	API_VERSION = "v1"

	//  initiaze webhook-secret for Hasura Authentication
	WEBHOOK_SECRET = "nhost-webhook-secret"

	//  initiaze admin-secret for Hasura Authentication
	ADMIN_SECRET = "nhost-admin-secret"
)

Variables

View Source
var JWT_KEY = "0f987876650b4a085e64594fae9219e7781b17506bec02489ad061fba8cb22db"
 Initiaze JWT key for Hasura Authentication
	JWT_KEY = generateRandomKey(32)
View Source
var (
	WORKING_DIR string
)

Functions

func DeleteAllPaths

func DeleteAllPaths(path string) error

deletes all the paths leading to the given file/folder and unlink from filesystem

func DeletePath

func DeletePath(path string) error

deletes the given file/folder path and unlink from filesystem

func GetIcon added in v0.5.9

func GetIcon(unicode, colour string) string

Returns the icon formatted in the specified color.

func Init added in v0.5.9

func Init(config Config)

func PathExists

func PathExists(filePath string) bool

validates whether a given folder/file path exists or not

func PortAvailable added in v0.6.2

func PortAvailable(port string) bool

func Rel

func Rel(path string) string

Returns path relative to Nhost current working directory

Types

type Config added in v0.5.9

type Config struct {
	WorkingDir string
	Writer     *Status
}

type Status added in v0.5.9

type Status struct {
	Value int
	Total int
	Text  string
	Icon  string
	// contains filtered or unexported fields
}

Status is an in-line output structure that holds the status text and icon

var (

	//  New base writer for all tasks
	Writer Status
)

func New added in v0.5.9

func New(showIcons bool) Status

Returns a new Status object

func (*Status) Clean added in v0.5.9

func (s *Status) Clean()

Delete all text from line, and shift cursor back to beginning of line

func (*Status) Error added in v0.5.9

func (s *Status) Error(text string)

Change the status icon to error, and set the text

func (*Status) Errorln added in v0.5.9

func (s *Status) Errorln(text string)

Print the status error in a new line

func (*Status) Executing added in v0.5.9

func (s *Status) Executing(text string)

Change the status icon to yellow coloured gear, and set the text

func (*Status) Executingln added in v0.5.9

func (s *Status) Executingln(text string)

Print the execution status in a new line

func (*Status) Fatal added in v0.5.9

func (s *Status) Fatal(text string)

Set the status error and exit CLI

func (*Status) Increment added in v0.5.9

func (s *Status) Increment(value int)

Increase the status value

func (*Status) Info added in v0.5.9

func (s *Status) Info(text string)

Change the status icon to info, and set the text

func (*Status) Infoln added in v0.5.9

func (s *Status) Infoln(text string)

Print the info status in a new line

func (*Status) Print added in v0.5.9

func (s *Status) Print()

Print the status text

func (*Status) Reset added in v0.5.9

func (s *Status) Reset()

Reset total status value

func (*Status) Set added in v0.5.9

func (s *Status) Set(text string)

Set the status text

func (*Status) Success added in v0.5.9

func (s *Status) Success(text string)

Change the status icon to success, and set the text

func (*Status) Successln added in v0.5.9

func (s *Status) Successln(text string)

Print the success status in a new line

func (*Status) Suppressed added in v0.5.9

func (s *Status) Suppressed(text string)

Change the status icon to gray coloured gear, and set the text

func (*Status) Suppressedln added in v0.5.9

func (s *Status) Suppressedln(text string)

Print the supressed status in a new line

func (*Status) Update added in v0.5.9

func (s *Status) Update(value int)

Update total status value

func (*Status) Warn added in v0.5.9

func (s *Status) Warn(text string)

Change the status icon to warning, and set the text

func (*Status) Warnln added in v0.5.9

func (s *Status) Warnln(text string)

Print the warning status in a new line

Jump to

Keyboard shortcuts

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