execute

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package execute is a simple package that wraps the os/exec Command features for convenient use in asdf. It was inspired by https://github.com/chen-keinan/go-command-eval

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToSlice

func MapToSlice(env map[string]string) (slice []string)

MapToSlice converts an env map to env slice suitable for syscall.Exec

Types

type Command

type Command struct {
	Command    string
	Expression string
	Args       []string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Env        map[string]string
}

Command represents a Bash command that can be executed by asdf

func New

func New(command string, args []string) Command

New takes a string containing the path to a Bash script, and a slice of string arguments and returns a Command struct

func NewExpression

func NewExpression(expression string, args []string) Command

NewExpression takes a string containing a Bash expression and a slice of string arguments and returns a Command struct

func (Command) Run

func (c Command) Run() error

Run executes a Command with Bash and returns the error if there is one

Jump to

Keyboard shortcuts

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