Documentation ¶
Index ¶
- Constants
- Variables
- func Command(name string, args ...string) *exec.Cmd
- func CommandWithCancel(name string, args ...string) (*exec.Cmd, context.CancelFunc)
- func Dest(dest string) string
- func Download(url string, body io.Reader, options ...DownloadOption) ([]byte, error)
- func DownloadFile(repo, version, name string) ([]byte, error)
- func DownloadReader(url string, body io.Reader, options ...DownloadOption) (io.ReadCloser, error)
- func Exists(path string) bool
- func Export(destFile string, v interface{}) error
- func Ext(s string) string
- func FindMatches(rootDir, pattern string, listDirectories bool) ([]string, error)
- func FormatExecutable(bin string) string
- func GetAllFiles(rootDir string) (files []string, err error)
- func GetFilesDiff(rootDir string) (func() []string, error)
- func Import(sourceFile string, dest interface{}) error
- func InitClient(proxyAddr string)
- func IsDir(path string) bool
- func IsInsideDocker() bool
- func KillCommand(cmd *exec.Cmd) error
- func ListReleases(repo string) []string
- func NoOpReadCloser(r io.Reader) io.ReadCloser
- func ReadJSON(url string, ptr interface{}) error
- func RegisterOnInterrupt(cb func())
- func SplitNameVersion(s string) (name string, version string)
- func StartExecutable(dir, bin string, stdout, stderr io.Writer) (*exec.Cmd, error)
- type DownloadOption
- type Filter
- type Watcher
Constants ¶
Variables ¶
var DefaultClient = http.DefaultClient
DefaultClient is the default client all http requests are fired from.
var Interrupt = new(interruptListener)
Interrupt watches the os.Signals for interruption signals and fires the callbacks when those happens. A call of its `FireNow` manually will fire and reset the registered interrupt handlers.
Functions ¶
func Command ¶
Command returns the Cmd struct to execute the named program with the given arguments for windows.
func CommandWithCancel ¶
CommandWithCancel same as `Command` but returns a canceletion function too.
func Download ¶
Download returns the body of "url". It uses the `http.DefaultClient` to download the resource specified by the "url" input argument.
func DownloadFile ¶
DownloadFile returns the contents of a github file inside a repository.
func DownloadReader ¶
func DownloadReader(url string, body io.Reader, options ...DownloadOption) (io.ReadCloser, error)
DownloadReader returns a response reader.
func Export ¶
Export exports "v" to "destFile" system file. It creates it if it does not exist and overrides it if contains data.
func FindMatches ¶
FindMatches find all matches of a "pattern" reclusively. Ordered by parent dir.
func FormatExecutable ¶
func GetAllFiles ¶
GetAllFiles returns all files and directories from "rootDir". The return "files" as fullpaths.
func GetFilesDiff ¶
GetFilesDiff returns a function which collects new files or directories since `GetFilesDiff` called. Its return function's slice contains a relative to "rootDir" filenames.
func IsInsideDocker ¶
func IsInsideDocker() bool
IsInsideDocker reports whether the iris-cli is running through a docker container.
func KillCommand ¶
func ListReleases ¶
ListReleases lists all releases of a github "repo".
func NoOpReadCloser ¶
func NoOpReadCloser(r io.Reader) io.ReadCloser
NoOpReadCloser wraps the "r" and returns a new io.ReadCloser which its `Close` does nothing.
func RegisterOnInterrupt ¶
func RegisterOnInterrupt(cb func())
RegisterOnInterrupt registers a global function to call when CTRL+C/CMD+C pressed or a unix kill command received.
func SplitNameVersion ¶
SplitNameVersion accepts a string and returns its name and version.
Types ¶
type DownloadOption ¶
DownloadOption is the type of third, variadic input argument of the `Download` package-level function. Could change or read the request before use.
type Watcher ¶
type Watcher struct { AddFilter Filter Events chan []fsnotify.Event Dirs []string // contains filtered or unexported fields }