Help us shape the future of Go! Take the 2026 Go Developer Survey

utils

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPathExists

func CheckPathExists(path string) error

func CleanupDownloadedDir

func CleanupDownloadedDir() error

func CompileFromLocal

func CompileFromLocal(path string) (map[string]cue.Value, error)

compileFromLocal processes either a single file or all files in a directory.

func CompileFromURL

func CompileFromURL(client *github.Client, u *url.URL) (map[string]cue.Value, error)

compileFromURL parses the Github URL, reads the contents and compiles it to Cue Value

func CreateGitHubClient

func CreateGitHubClient(token string) *github.Client

func ExtractPackageName

func ExtractPackageName(content []byte) (string, error)

func FetchFromGitHub

func FetchFromGitHub(urlStr string) (*github.RepositoryContent, []*github.RepositoryContent, error)

func IsURL

func IsURL(s string) bool

func ProcessInputs

func ProcessInputs(inputs []string) ([]string, error)

ProcessInputs processes the CLI args, fetches content from URLs if needed, and returns a slice of filenames.

func ReadFile

func ReadFile(content string) ([]byte, error)

ReadFile reads the files provided from cli args and returns []byte and an error if any

func StartSpinner

func StartSpinner(msg string) *spinner.Spinner

StartSpinner starts a spinner with the given message.

func TempDirWithCleanup

func TempDirWithCleanup() (dirPath string, cleanupFunc func(), err error)

TempDirWithCleanup creates a temporary directory and returns its path along with a cleanup function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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