micro: github.com/zyedidia/micro/internal/shell Index | Files

package shell

import "github.com/zyedidia/micro/internal/shell"

Index

Package Files

job.go shell.go terminal.go

Constants

const (
    TTClose   = iota // Should be closed
    TTRunning        // Currently running a command
    TTDone           // Finished running a command
)

Variables

var CloseTerms chan bool
var Jobs chan JobFunction

func ExecCommand Uses

func ExecCommand(name string, arg ...string) (string, error)

ExecCommand executes a command using exec It returns any output/errors

func JobSend Uses

func JobSend(cmd *exec.Cmd, data string)

JobSend sends the given data into the job's stdin stream

func JobSpawn Uses

func JobSpawn(cmdName string, cmdArgs []string, onStdout, onStderr, onExit func(string, []interface{}), userargs ...interface{}) *exec.Cmd

JobSpawn starts a process with args in the background with the given callbacks It returns an *exec.Cmd as the job id

func JobStart Uses

func JobStart(cmd string, onStdout, onStderr, onExit func(string, []interface{}), userargs ...interface{}) *exec.Cmd

JobStart starts a shell command in the background with the given callbacks It returns an *exec.Cmd as the job id

func JobStop Uses

func JobStop(cmd *exec.Cmd)

JobStop kills a job

func RunBackgroundShell Uses

func RunBackgroundShell(input string) (func() string, error)

RunBackgroundShell runs a shell command in the background It returns a function which will run the command and returns a string message result

func RunCommand Uses

func RunCommand(input string) (string, error)

RunCommand executes a shell command and returns the output/error

func RunInteractiveShell Uses

func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error)

RunInteractiveShell runs a shellcommand interactively

type CallbackFile Uses

type CallbackFile struct {
    io.Writer
    // contains filtered or unexported fields
}

A CallbackFile is the data structure that makes it possible to catch stderr and stdout write events

func (*CallbackFile) Write Uses

func (f *CallbackFile) Write(data []byte) (int, error)

type CallbackFunc Uses

type CallbackFunc func(string)

type JobFunction Uses

type JobFunction struct {
    Function func(string, []interface{})
    Output   string
    Args     []interface{}
}

JobFunction is a representation of a job (this data structure is what is loaded into the jobs channel)

type TermType Uses

type TermType int

type Terminal Uses

type Terminal struct {
    State terminal.State
    Term  *terminal.VT

    Status    TermType
    Selection [2]buffer.Loc
    // contains filtered or unexported fields
}

A Terminal holds information for the terminal emulator

func (*Terminal) Close Uses

func (t *Terminal) Close()

Close sets the Status to TTClose indicating that the terminal is done and should be closed

func (*Terminal) GetSelection Uses

func (t *Terminal) GetSelection(width int) string

GetSelection returns the selected text

func (*Terminal) HasSelection Uses

func (t *Terminal) HasSelection() bool

HasSelection returns whether this terminal has a valid selection

func (*Terminal) Name Uses

func (t *Terminal) Name() string

func (*Terminal) Start Uses

func (t *Terminal) Start(execCmd []string, getOutput bool, wait bool, callback func(out string, userargs []interface{}), userargs []interface{}) error

Start begins a new command in this terminal with a given view

func (*Terminal) Stop Uses

func (t *Terminal) Stop()

Stop stops execution of the terminal and sets the Status to TTDone

func (*Terminal) WriteString Uses

func (t *Terminal) WriteString(str string)

WriteString writes a given string to this terminal's pty

Package shell imports 13 packages (graph) and is imported by 3 packages. Updated 2020-02-14. Refresh now. Tools for package owners.