utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedEditors = []string{
	"/bin/ed",
	"/bin/nano",
	"/usr/bin/vim",
	"nano",
	"vim",
}

AllowedEditors is a list of allowed values for the EDITOR environment variable. FIXME: prevent unknown command execution when some of these editor is not available. FIXME: make this a function so is not directly modifiable.

Functions

func DeleteFile

func DeleteFile(filepath string) error

DeleteFile deletes a file from disk.

func Exists

func Exists(path string) bool

Exists verify a specific path exists.

func OpenWithEditor

func OpenWithEditor(path string) error

OpenWithEditor open the specified path with the EDITOR set in the corresponding environment variable.

func PersistExecutableFile

func PersistExecutableFile(path, content string) error

PersistExecutableFile writes a content to a path and make it executable.

func PersistFile

func PersistFile(path, content string) error

PersistFile writes content to a path.

func ReadFile

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

func Walk

func Walk(source string) ([]string, error)

Walk walks the specified source path and return a slice of absolute paths contained.

func WalkRelative

func WalkRelative(source string) ([]string, error)

WalkRelative walks the specified source path and return a slice of relative paths contained.

Types

This section is empty.

Jump to

Keyboard shortcuts

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