Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
minor bug fixes and extra docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstanley committed Nov 28, 2016
1 parent 609a5a4 commit 9900f2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 5 additions & 5 deletions main.go
Expand Up @@ -428,12 +428,12 @@ func updateCheck() {

if data.Tag == version {
out.Println("{green}your version of marill is up to date{c}")
logger.Println("update check: up to date. current: %s, latest: %s (%s)", version, data.Tag, data.Name)
logger.Printf("update check: up to date. current: %s, latest: %s (%s)", version, data.Tag, data.Name)
return
}

out.Println("{bold}{yellow}there is an update available for marill. current: %s new: %s (%s){c}", version, data.Tag, data.Name)
out.Println("release link: %s", data.URL)
out.Printf("{bold}{yellow}there is an update available for marill. current: %s new: %s (%s){c}", version, data.Tag, data.Name)
out.Printf("release link: %s", data.URL)
logger.Printf("update check found update %s available (doesn't match current: %s): %s", data.Tag, version, data.URL)

return
Expand Down Expand Up @@ -490,15 +490,15 @@ func run(c *cli.Context) error {
continue
}

err := tmplFormatted.Execute(os.Stdout, res)
err = tmplFormatted.Execute(os.Stdout, res)
if err != nil {
out.Println("")
out.Fatal("executing template:", err)
}

if len(conf.out.resultFile) > 0 {
// pipe it to the result file as necessary.
err := tmpl.Execute(resultFn, res)
err = tmpl.Execute(resultFn, res)
if err != nil {
out.Println("")
out.Fatal("executing template:", err)
Expand Down
10 changes: 7 additions & 3 deletions output.go
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/tdewolff/minify/js"
)

// JSONOutput is the generated json that will be embedded in Angular
// JSONOutput is the generated json that will be embedded in Angular.
type JSONOutput struct {
Version string
MinScore float64
Expand All @@ -31,6 +31,7 @@ type JSONOutput struct {
TimeScanned string
}

// Bytes returns a bytes array representation of JSONOutput.
func (j *JSONOutput) Bytes() []byte {
jsonBytes, err := json.Marshal(j)
if err != nil {
Expand All @@ -40,6 +41,7 @@ func (j *JSONOutput) Bytes() []byte {
return jsonBytes
}

// String returns a string representation of JSONOutput.
func (j *JSONOutput) String() string {
jsonBytes, err := json.Marshal(j)
if err != nil {
Expand All @@ -49,6 +51,7 @@ func (j *JSONOutput) String() string {
return fmt.Sprintf("%s", jsonBytes)
}

// StringPretty returns a prettified/indented representation of JSONOutput.
func (j *JSONOutput) StringPretty() string {
jsonBytes, err := json.MarshalIndent(j, "", " ")
if err != nil {
Expand All @@ -58,8 +61,9 @@ func (j *JSONOutput) StringPretty() string {
return fmt.Sprintf("%s", jsonBytes)
}

// HTMLDomResult is a wrapper around the test results, providing string representations
// of some errors and other items that during JSON conversion get converted to structs.
// HTMLDomResult is a wrapper around the test results, providing string
// representations of some errors and other items that during JSON conversion
// get converted to structs.
type HTMLDomResult struct {
*TestResult
ErrorString string // string representation of any errors
Expand Down

0 comments on commit 9900f2e

Please sign in to comment.