Skip to content

Commit ec29bc0

Browse files
committed
Add a couple exampls for godoc
Signed-off-by: Matt Stratton <matt.stratton@gmail.com>
1 parent d07fb41 commit ec29bc0

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

cmd/config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var configCmd = &cobra.Command{
2828
fmt.Println("Current Working Directory = ", pwd)
2929
fmt.Println("DevOpsDays web directory = ", webdir)
3030
color.Blue("Checking your config...")
31-
checkHugo()
31+
CheckHugo()
3232
checkGit()
3333
},
3434
}
@@ -38,7 +38,10 @@ func init() {
3838

3939
}
4040

41-
func checkHugo() {
41+
// CheckHugo tests whether or not a compatible version of the Hugo static site generator is instealled.
42+
//
43+
// Currently, the list of supported versions is hard-coded using the `supportedVersions` variable, but this should be moved elsewhere eventually.
44+
func CheckHugo() {
4245
supportedVersions := map[string]bool{"0.36.1": true, "0.37": true, "0.37.1": true}
4346
out, err := exec.Command("hugo", "version").Output()
4447
if err != nil {

event/check_event_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package event
22

33
import (
4+
"fmt"
45
"testing"
56

67
. "github.com/smartystreets/goconvey/convey"
@@ -30,3 +31,12 @@ func TestCheckEvent(t *testing.T) {
3031
})
3132
})
3233
}
34+
35+
func ExampleCheckEvent() {
36+
city := "Ponyville"
37+
year := "2017"
38+
if CheckEvent(city, year) {
39+
fmt.Println("This event already exists. If you would like to edit it, please run `devopsdays-cli edit event`")
40+
return
41+
}
42+
}

0 commit comments

Comments
 (0)