Documentation ¶
Index ¶
- type Cmd
- type File
- type GitOS
- func (g GitOS) Command(name string, args ...string) Cmd
- func (g GitOS) LookPath(file string) (string, error)
- func (g GitOS) Mkdir(name string, perm os.FileMode) error
- func (g GitOS) MkdirAll(path string, perm os.FileMode) error
- func (g GitOS) NewTicker(d time.Duration) Ticker
- func (g GitOS) ReadDir(dirname string) ([]os.FileInfo, error)
- func (g GitOS) Remove(name string) error
- func (g GitOS) Sleep(d time.Duration)
- func (g GitOS) Stat(name string) (os.FileInfo, error)
- func (g GitOS) TempDir() string
- func (g GitOS) TempFile(dir, prefix string) (File, error)
- func (g GitOS) TimeSince(t time.Time) time.Duration
- type GitTicker
- type OS
- type Ticker
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) // Process is the underlying process, once started. Process() *os.Process }
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.
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) // TempDir returns the default directory to use for temporary files. TempDir() string // Sleep pauses the current goroutine for at least the duration d. A // negative or zero duration causes Sleep to return immediately. Sleep(time.Duration) // NewTicker returns a new Ticker containing a channel that will send the // time with a period specified by the argument. NewTicker(time.Duration) Ticker // TimeSince returns the time elapsed since the argument. TimeSince(time.Time) time.Duration }
OS is an abstraction for required OS level functions.
Click to show internal directories.
Click to hide internal directories.