executil

package
v0.0.0-...-3288d0b Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentUser

func CurrentUser() string

CurrentUser gets the current user's name. If it fails, then a panic is thrown.

func CurrentUserIs

func CurrentUserIs(thisUser string) bool

CurrentUserIs returns true if the given thisUser's name matches the current username.

func Exec

func Exec(ctx context.Context, out *string, arg0 string, argv ...string) error

Exec executes a command.

func WithOpts

func WithOpts(ctx context.Context, opts Opts) context.Context

WithOpts inserts the given Opts into the context to be used. It overrides the parent Opts, if any.

func WithVerbose

func WithVerbose(ctx context.Context) context.Context

WithVerbose puts all Exec calls using the returned context into verbose mode, meaning stderr will be used.

Types

type Opts

type Opts struct {
	UseSudo  bool
	Username string
}

Opts contains the options to be used during evaluation.

func OptsFromContext

func OptsFromContext(ctx context.Context) Opts

OptsFromContext returns the Opts from the given context.

Jump to

Keyboard shortcuts

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