util

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package util handles commands

Package util handles nil

Package util handles pathing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanFileName added in v0.2.2

func CleanFileName(file string) string

CleanFileName will strip unwanted characters from a file system name

func IsNil

func IsNil(val any) bool

IsNil will attempt to detect nil from any

func PathExists

func PathExists(path string) bool

PathExists indicates if a file exists

Types

type CommandRunner

type CommandRunner struct{}

CommandRunner is the default command runner

func (CommandRunner) Output

func (r CommandRunner) Output(cmd string, args ...string) ([]byte, error)

Output will get command output

func (CommandRunner) Run

func (r CommandRunner) Run(settings RunSettings, cmd string, args ...string) error

Run will run a command with settings

func (CommandRunner) RunCommand added in v0.1.4

func (r CommandRunner) RunCommand(cmd string, args ...string) error

RunCommand will run a command with default settings

type RunSettings added in v0.1.4

type RunSettings struct {
	Dir string
	Env struct {
		Clear bool
	}
}

RunSettings configure how a command is run

type Runner

type Runner interface {
	RunCommand(string, ...string) error
	Output(string, ...string) ([]byte, error)
	Run(RunSettings, string, ...string) error
}

Runner is the runner interface for exec'ing

Jump to

Keyboard shortcuts

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