helper

package
v2.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(url, saveDir string, rename ...string) error

Download file from remote URL. from https://gist.github.com/albulescu/e61979cc852e4ee8f49c

func GetScreenSize

func GetScreenSize() (w int, h int)

GetScreenSize for current console terminal. TODO ...

func RenderText

func RenderText(input string, data interface{}, fns template.FuncMap, isFile ...bool) string

RenderText render text template with data

func ShellExec

func ShellExec(cmdStr string, dirAndShell ...string) (string, error)

ShellExec exec a CLI command by shell and return output. Usage:

ShellExec("ls -al")
ShellExec("ls -al", "/usr/lib")
ShellExec("ls -al", "/usr/lib", "/bin/zsh")

func SimpleDownload

func SimpleDownload(url, saveAs string) (err error)

SimpleDownload simple download

Types

type Downloader

type Downloader struct {
	FileURL  string
	SaveDir  string
	Filename string // save file name.
	Progress bool   // display progress info
	// contains filtered or unexported fields
}

Downloader struct definition. refer: https://gist.github.com/albulescu/e61979cc852e4ee8f49c

func (*Downloader) Download

func (d *Downloader) Download() error

Download begin

Jump to

Keyboard shortcuts

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