nclib

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandActionDo   = CommandAction("Do")
	CommandActionUndo = CommandAction("Undo")
	CommandActionEnd  = CommandAction("End")
)

Variables

This section is empty.

Functions

func CallFunctions

func CallFunctions(reverse bool, fs ...func() error) error

func DoCommands

func DoCommands(mon CommandMon, dryRun bool, cmds ...Command) error

func EndCommands

func EndCommands(mon CommandMon, dryRun bool, cmds ...Command) error

func UndoCommands

func UndoCommands(mon CommandMon, dryRun bool, cmds ...Command)

Types

type Command

type Command interface {
	DoCommand() ([]byte, error)
	EndCommand() ([]byte, error)
	UndoCommand() ([]byte, error)
	Line(CommandAction) string
}

type CommandAction

type CommandAction string

type CommandMon

type CommandMon func(CommandAction, Command, []byte)

type Commands

type Commands struct {
	DryRun bool
	// contains filtered or unexported fields
}

func NewCommands

func NewCommands(mon CommandMon) *Commands

func (*Commands) Add

func (c *Commands) Add(cmd Command) *Commands

func (*Commands) Clear

func (c *Commands) Clear()

func (*Commands) Do

func (c *Commands) Do() error

func (*Commands) End

func (c *Commands) End() error

func (*Commands) Set

func (c *Commands) Set(cmd Command, pos int) *Commands

func (*Commands) Size

func (c *Commands) Size() int

func (*Commands) Undo

func (c *Commands) Undo()

type Shell

type Shell struct {
	In io.Reader
	// contains filtered or unexported fields
}

func NewShell

func NewShell(cmd string, args ...string) *Shell

func NewShellIn

func NewShellIn(cmd string, in io.Reader, args ...string) *Shell

func (*Shell) Exec

func (s *Shell) Exec() ([]byte, error)

func (*Shell) String

func (s *Shell) String() string

type ShellCommand

type ShellCommand struct {
	// contains filtered or unexported fields
}

func NewShellCommand

func NewShellCommand(doCmd, undoCmd, endCmd *Shell) *ShellCommand

func (*ShellCommand) DoCommand

func (s *ShellCommand) DoCommand() ([]byte, error)

func (*ShellCommand) EndCommand

func (s *ShellCommand) EndCommand() ([]byte, error)

func (*ShellCommand) Line

func (s *ShellCommand) Line(action CommandAction) string

func (*ShellCommand) String

func (s *ShellCommand) String() string

func (*ShellCommand) UndoCommand

func (s *ShellCommand) UndoCommand() ([]byte, error)

type SrChanges

type SrChanges map[string]struct{}

func NewSrChanges

func NewSrChanges() SrChanges

func (SrChanges) Compare

func (c SrChanges) Compare(keys ...string) bool

func (SrChanges) GetChange

func (c SrChanges) GetChange(key string) bool

func (SrChanges) GetChanges

func (c SrChanges) GetChanges(keys ...string) bool

func (SrChanges) OneOfChange

func (c SrChanges) OneOfChange(keys ...string) bool

func (SrChanges) SetChange

func (c SrChanges) SetChange(key string)

func (SrChanges) SetChanges

func (c SrChanges) SetChanges(keys ...string)

func (SrChanges) String

func (c SrChanges) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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