Documentation ¶
Index ¶
- func Download(ctx context.Context, req *Request) error
- type Command
- type CommandArgs
- type ErrDownload
- type Request
- type RequestOpt
- func WithRequestAuthPassword(password string) RequestOpt
- func WithRequestAuthUser(user string) RequestOpt
- func WithRequestDestination(dst io.WriteCloser) RequestOpt
- func WithRequestSHA256(sha string) RequestOpt
- func WithRequestURL(u string) RequestOpt
- func WithRequestWriteStdout(enabled bool) RequestOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is a cli.Command.
func NewCommand ¶
NewCommand takes a user interface and returns a new cli.Command.
type CommandArgs ¶
type CommandArgs struct {
// contains filtered or unexported fields
}
CommandArgs are the download commands arguments.
func (*CommandArgs) Parse ¶
func (a *CommandArgs) Parse(args []string) error
Parse parses the raw args and maps them to the CommandArgs.
type ErrDownload ¶
ErrDownload is a download error.
func (*ErrDownload) Error ¶
func (e *ErrDownload) Error() string
Error returns the error as a string.
type Request ¶
type Request struct { URL *url.URL HTTPMethod string Destination io.WriteCloser SHA256 string AuthUser string AuthPassword string WriteStdout bool }
Request is a download request.
func NewRequest ¶
func NewRequest(opts ...RequestOpt) (*Request, error)
NewRequest takes N RequestOpt args and returns a new request.
type RequestOpt ¶
RequestOpt are functional options for a new Request.
func WithRequestAuthPassword ¶
func WithRequestAuthPassword(password string) RequestOpt
WithRequestAuthPassword sets the basic auth password.
func WithRequestAuthUser ¶
func WithRequestAuthUser(user string) RequestOpt
WithRequestAuthUser sets the basic auth user.
func WithRequestDestination ¶
func WithRequestDestination(dst io.WriteCloser) RequestOpt
WithRequestDestination sets the destination.
func WithRequestSHA256 ¶
func WithRequestSHA256(sha string) RequestOpt
WithRequestSHA256 sets the required SHA 256 sum.
func WithRequestURL ¶
func WithRequestURL(u string) RequestOpt
WithRequestURL sets the source download URL.
func WithRequestWriteStdout ¶
func WithRequestWriteStdout(enabled bool) RequestOpt
WithRequestWriteStdout sets whether or not we should write the body to STDOUT.