utils

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackendURL = "https://cakes.run/api"

Functions

func Check

func Check(err error)

func ClearScreen

func ClearScreen()

func Colorize

func Colorize(color, text string) string

func CutDaCommands added in v0.1.1

func CutDaCommands(dir string, cmds map[int][2]string, order []int) error

func CutDir

func CutDir(dir string, conf *Config, ans Data) error

func CutFiles

func CutFiles(dir string, conf *Config, ans Data) error

func CutTheQuestions added in v0.1.1

func CutTheQuestions(ans *map[string]string, conf *Config) error

func GetToken added in v0.2.6

func GetToken() (*string, error)

func Input added in v0.2.0

func Input(ques string, def string, ans *string, validate func(string) error) error

func LoggedIn

func LoggedIn() (*string, bool, error)

func Login

func Login()

func Logout

func Logout() error

func MakeItSpin

func MakeItSpin(f func(), suffix string)

func ParseCommands added in v0.2.8

func ParseCommands(cmds map[int][2]string, ans Data) ([]int, error)

func ParseQuery

func ParseQuery(str string) (url.Values, error)

func ParseUserJSON

func ParseUserJSON(body string) (*struct {
	Login string `json:"login"`
}, error)

func PathExists

func PathExists(path string) (bool, error)

func RemoveItemFromSlice

func RemoveItemFromSlice(slice []string, s int) []string

Types

type Config

type Config struct {
	Metadata struct {
		Name        string
		Description string
	} `toml:"metadata"`

	Content map[string]string `toml:"content"`

	FileStructure map[string]string `toml:"filestructure"`

	Commands map[int][2]string `toml:"toppings"`

	CommandsBefore map[int][2]string `toml:"batter"`

	Questions map[string][]struct {
		Question string   `toml:"ques"`
		Type     string   `toml:"type"`
		Options  []string `toml:"options"`
		Default  string   `toml:"default"`
	} `toml:"questions"`
}

func ParseFromFile

func ParseFromFile(file string) (*Config, error)

func ParseToml

func ParseToml(txt string) (*Config, error)

type Data added in v0.2.8

type Data struct {
	Ans      map[string]string
	Gatherer map[string]string
	Os       string
}

Jump to

Keyboard shortcuts

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