Documentation
¶
Index ¶
- func AreChecksumsEqual(f1, f2 string) (bool, error)
- func BuildRepoArchiveUrl(owner, repo, branch string) string
- func BuildRepoUrl(owner, repo string) string
- func ComputeFileChecksum(file string) (uint32, error)
- func Confirm(msg string, defaultVal bool, stdin io.Reader, stdout io.Writer) (bool, error)
- func CreateFile(path string) (*os.File, error)
- func CreateTempDir() error
- func DownloadFile(url, dst string) error
- func DownloadRepo(owner, repo, branch, dst string) error
- func RemoveTempDir() error
- func RenderTemplateDir(tmplDir, dstDir string, problem *EulerProblem, overwrite bool, stdin io.Reader, ...) error
- func SyncDirs(src, dst string, overwrite bool, stdin io.Reader, stdout io.Writer) error
- func SyncFiles(src, dst string, overwrite bool, stdin io.Reader, stdout io.Writer) error
- func TempPath(relPath string) string
- func Unzip(src, dst string) error
- func ValidateProblemStr(problemArgStr string) error
- func ValidateSingleProblemArg(cmd *cobra.Command, args []string) error
- type EulerProblem
- type MissingProblemError
- type ProblemArgError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreChecksumsEqual ¶
AreChecksumsEqual - compare checksums for two files
func BuildRepoArchiveUrl ¶ added in v0.3.0
BuildRepoArchiveURL - construct a URL pointing to a zipped Github Repo
func BuildRepoUrl ¶ added in v0.3.0
BuildRepoUrl - construct a URL for the given github repo
func ComputeFileChecksum ¶
ComputeFileChecksum - compute the crc32 checksum of a file
func Confirm ¶
Confirm - get a confirmation from the user. A "y" response will return true and an "n" response will return false
func CreateFile ¶
CreateFile - Creates a file and its directory if needed
func DownloadFile ¶
DownloadFile - download a file and save it to the specified destination
func DownloadRepo ¶
DownloadRepo - download a zipped copy of the specified GitHub repo
func RenderTemplateDir ¶
func RenderTemplateDir( tmplDir, dstDir string, problem *EulerProblem, overwrite bool, stdin io.Reader, stdout io.Writer, ) error
RenderTemplateDir - Render all files in the tmplDir into dst
func SyncFiles ¶
SyncFiles - Sync a source file a destination If the destination exists and overwrite is false, the user is asked to confirm the operation.
func Unzip ¶
Unzip - Unzip a zip archive Taken from https://stackoverflow.com/questions/20357223/easy-way-to-unzip-file-with-golang
func ValidateProblemStr ¶
ValidateProblemStr - Validate that the given string can be parsed as an integer
Types ¶
type EulerProblem ¶
type EulerProblem struct { ProblemNum int PaddedProblemNum string ProblemText string AnswerMD5 string Answer string }
EulerProblem - a structured type representing a project euler problem
func GetProblem ¶
func GetProblem(problemNum int) (*EulerProblem, error)
GetProblem - return an EulerProblem instance corresponding to the given problem number
type MissingProblemError ¶
MissingProblemError - used when the user requests a problem that doesn't exist
func (*MissingProblemError) Error ¶
func (e *MissingProblemError) Error() string
Error - convert a MissingProblemError into a string
type ProblemArgError ¶
type ProblemArgError struct {
// contains filtered or unexported fields
}
ProblemArgError - returned by ValidateSingleProblemArg when the problem argument is not parseable
func (*ProblemArgError) Error ¶
func (e *ProblemArgError) Error() string
Error - Convert a ProblemArgError into a string