golbin

package
v0.0.0-...-1bfd785 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cat

func Cat(filepath string) (string, error)

Cat returns full content of a file as string.

func Exec

func Exec(cmd string) (string, error)

func ExecOutput

func ExecOutput(cmdline string) string

ExecOutput can be passed a command to quickly get its output or error.

func ExecWithEnv

func ExecWithEnv(cmd string, env map[string]string) (string, error)

func Grep

func Grep(re, lines string) (string, error)

Grep tries matching lines in a file for given pattern and return matched lines.

func IsSystemCmd

func IsSystemCmd(cmd string) bool

If a command is present in available system path.

func MemInfo

func MemInfo(field string) string

MemInfo returns asked field value from /proc/meminfo.

func RunWithAssignedApp

func RunWithAssignedApp(runThis string) string

Run it for distro to manage opening with correct program

func Uptime

func Uptime() string

Uptime proxies linux system command for 'uptime'.

Types

type Console

type Console struct {
	Command, StdInput, StdOutput string
	Process                      *os.Process
}

Console is structure to contain Command Line, Input and Output.

func (*Console) Run

func (konsole *Console) Run() (err error)

Run executes command from Console field with its input and sets the output or error whatever gets prompted.

type ConsolePipe

type ConsolePipe struct {
	Konsole  Console
	PipePath string
}

func (*ConsolePipe) Clean

func (konsolePipe *ConsolePipe) Clean()

Clean cleans up the process and then the pipe.

func (*ConsolePipe) Pipe

func (konsolePipe *ConsolePipe) Pipe(input string) error

Pipe pipes given input to PipePath.

func (*ConsolePipe) Run

func (konsolePipe *ConsolePipe) Run() error

Run executes command from console with a pipe to get back.

Jump to

Keyboard shortcuts

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