add usage

This commit is contained in:
Adrien Marquès 2019-11-22 23:02:55 +01:00
parent 77f4101d74
commit 2b2b3066b6
2 changed files with 48 additions and 0 deletions

15
print.go Normal file
View File

@ -0,0 +1,15 @@
package main
import "fmt"
func bold(str string) string {
return fmt.Sprintf("\x1b[1m%s\x1b[0m", str)
}
func success(str string) string {
return fmt.Sprintf("\x1b[58;2;26;221;120m%s\x1b[0m", str)
}
func error(str string) string {
return fmt.Sprintf("\x1b[58;2;221;26;120m%s\x1b[0m", str)
}

33
usage.go Normal file
View File

@ -0,0 +1,33 @@
package main
import "fmt"
func usage() {
fmt.Printf(`
%s
cliverage - print human-readable golang code coverage
%s
%s codepath coverfile [filepath]
%s
codepath
Path to where lives your code
coverfile
Path to the coverage file generated by "go test -coverprofile".
filepath
Optional path to a file (relative to %s).
%s
Adrien Marquès (aka. xdrm-brackets)
`,
bold("NAME"),
bold("SYNOPSIS"),
bold("cliverage"),
bold("ARGUMENTS"),
bold("codepath"),
bold("AUTHORS"),
)
}