gitos

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	// Run starts the specified command and waits for it to complete.
	Run() error

	// Start starts the specified command but does not wait for it to complete.
	Start() error

	// Wait waits for the command to exit. It must have been started by Start.
	Wait() error

	// Output runs the command and returns its standard output.
	Output() ([]byte, error)

	// Dir sets the working directory of the command.
	Dir(string)

	// Stdin sets the process's standard input.
	Stdin(io.Reader)

	// Stdout sets the process's standard output.
	Stdout(io.Writer)

	// Stderr sets the process's standard output.
	Stderr(io.Writer)
}

Cmd is an abstraction for external commands (os.Cmd).

type File

type File interface {
	// Name returns the name of the file
	Name() string

	// Stat returns the FileInfo structure describing file.
	Stat() (os.FileInfo, error)

	// Close closes the File, rendering it unusable for I/O.
	Close() error

	// Chmod changes the mode of the file.
	Chmod(os.FileMode) error

	// Read reads up to len(b) bytes from the File. It returns the number of
	// bytes read and an error, if any.
	Read([]byte) (int, error)

	// Write writes len(b) bytes to the File. It returns the number of bytes
	// written and an error, if any.
	Write([]byte) (int, error)
}

File is an abstraction for file (os.File).

type GitOS

type GitOS struct{}

GitOS is the implementation of OS for git.

func (GitOS) Command

func (g GitOS) Command(name string, args ...string) Cmd

Command calls exec.Command.

func (GitOS) LookPath

func (g GitOS) LookPath(file string) (string, error)

LookPath calls exec.LookPath.

func (GitOS) Mkdir

func (g GitOS) Mkdir(name string, perm os.FileMode) error

Mkdir calls os.Mkdir.

func (GitOS) MkdirAll

func (g GitOS) MkdirAll(path string, perm os.FileMode) error

MkdirAll calls os.MkdirAll.

func (GitOS) ReadDir

func (g GitOS) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir calls ioutil.ReadDir.

func (GitOS) Remove

func (g GitOS) Remove(name string) error

Remove calls os.Remove.

func (GitOS) Stat

func (g GitOS) Stat(name string) (os.FileInfo, error)

Stat calls os.Stat.

func (GitOS) TempFile

func (g GitOS) TempFile(dir, prefix string) (File, error)

TempFile calls ioutil.TempFile.

type OS

type OS interface {
	// Command returns the Cmd to execute the named program with the
	// given arguments.
	Command(string, ...string) Cmd

	// Mkdir creates a new directory with the specified name and permission
	// bits.
	Mkdir(string, os.FileMode) error

	// MkdirAll creates a directory named path, along with any necessary
	// parents.
	MkdirAll(string, os.FileMode) error

	// Stat returns a FileInfo describing the named file.
	Stat(string) (os.FileInfo, error)

	// Remove removes the named file or directory.
	Remove(string) error

	// ReadDir reads the directory named by dirname and returns a list of
	// directory entries.
	ReadDir(string) ([]os.FileInfo, error)

	// LookPath searches for an executable binary named file in the directories
	// named by the PATH environment variable.
	LookPath(string) (string, error)

	// TempFile creates a new temporary file in the directory dir with a name
	// beginning with prefix, opens the file for reading and writing, and
	// returns the resulting File.
	TempFile(string, string) (File, error)
}

OS is an abstraction for required OS level functions.

Jump to

Keyboard shortcuts

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