utils

package
v0.0.0-...-e394087 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(dir string, force bool, name string, content []byte, perm fs.FileMode) error

CreateFile creates a file in the given directory with the given content. Use a truthy value for force to override an existing file.

func ExtractNamespace

func ExtractNamespace(instanceDir string) string

extractNamespace gets the namespace from instance directory path Example: "/real/path/to/my.instance.dir.url" -> "myinstancedirurl"

func FileExists

func FileExists(p string) (bool, error)

fileExists is a small helper function to check if a file already exists. It is not save in concurrent usage.

func IsYAMLFile

func IsYAMLFile(filename string) bool

isYAMLFile checks if filename has YAML extension

func ReadFromFileOrStdin

func ReadFromFileOrStdin(filename string) ([]byte, error)

ReadFromFileOrStdin reads from a file or stdin if filename is "-"

func ReadInputOrFileOrStdin

func ReadInputOrFileOrStdin(input, filename string) ([]byte, error)

ReadInputOrFileOrStdin reads data from either a positional argument, a file, or stdin

func ReadPassword

func ReadPassword(passwordFile string) (string, error)

ReadPassword reads password from a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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