Skip to content

Commit ab25afc

Browse files
authored
Quick wins (#126)
* Update supported hugo versions Also fixed style issue in cmd/config.go for range of supported versions Signed-off-by: Matt Stratton <matt.stratton@gmail.com> * A whole bunch more quick wins Signed-off-by: Matt Stratton <matt.stratton@gmail.com>
1 parent 3387266 commit ab25afc

18 files changed

Lines changed: 40 additions & 48 deletions

.ebert.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ engines:
2222
enabled: true
2323
exclude_paths:
2424
- testdata
25+
- vendor
26+
- .version.sh
2527

cmd/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var configCmd = &cobra.Command{
1818
Short: "Returns the current configuration",
1919
Long: `Displays any environment variables and configurations.`,
2020
Run: func(cmd *cobra.Command, args []string) {
21-
// TODO: Work your own magic here
2221
color.Blue("Current configuration")
2322
fmt.Println("DODPATH = ", os.Getenv("DODPATH"))
2423
pwd, err := os.Getwd()
@@ -40,7 +39,7 @@ func init() {
4039
}
4140

4241
func checkHugo() {
43-
supportedVersions := map[string]bool{"0.23": true, "0.24.1": true, "0.25.1": true, "0.26": true, "0.27": true, "0.28": true, "0.29": true}
42+
supportedVersions := map[string]bool{"0.36.1": true, "0.37": true, "0.37.1": true}
4443
out, err := exec.Command("hugo", "version").Output()
4544
if err != nil {
4645
log.Fatal(err)
@@ -53,7 +52,7 @@ func checkHugo() {
5352
} else {
5453
fmt.Println("\u2717 Hugo version", hugoVersion, "is incompatible.")
5554
fmt.Println("Supported Versions are:")
56-
for k, _ := range supportedVersions {
55+
for k := range supportedVersions {
5756
fmt.Println(k)
5857
}
5958
}

cmd/event.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ and usage of using your command. For example:
1717
Cobra is a CLI library for Go that empowers applications.
1818
This application is a tool to generate the needed files
1919
to quickly create a Cobra application.`,
20-
// Run: func(cmd *cobra.Command, args []string) {
21-
// // TODO: Work your own magic here
22-
// fmt.Println("speaker called")
23-
// },
2420
}
2521

2622
// createEventCmd represents the "create event" command

cmd/organizer.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Cobra is a CLI library for Go that empowers applications.
1717
This application is a tool to generate the needed files
1818
to quickly create a Cobra application.`,
1919
Run: func(cmd *cobra.Command, args []string) {
20-
// TODO: Work your own magic here
2120
createOrganizer()
2221
},
2322
}
@@ -33,7 +32,6 @@ Cobra is a CLI library for Go that empowers applications.
3332
This application is a tool to generate the needed files
3433
to quickly create a Cobra application.`,
3534
Run: func(cmd *cobra.Command, args []string) {
36-
// TODO: Work your own magic here
3735
editOrganizerFake()
3836
},
3937
}
@@ -49,7 +47,6 @@ Cobra is a CLI library for Go that empowers applications.
4947
This application is a tool to generate the needed files
5048
to quickly create a Cobra application.`,
5149
Run: func(cmd *cobra.Command, args []string) {
52-
// TODO: Work your own magic here
5350
removeOrganizer()
5451
},
5552
}
@@ -65,7 +62,6 @@ Cobra is a CLI library for Go that empowers applications.
6562
This application is a tool to generate the needed files
6663
to quickly create a Cobra application.`,
6764
Run: func(cmd *cobra.Command, args []string) {
68-
// TODO: Work your own magic here
6965
showOrganizer()
7066
},
7167
}

cmd/program.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Cobra is a CLI library for Go that empowers applications.
1717
This application is a tool to generate the needed files
1818
to quickly create a Cobra application.`,
1919
Run: func(cmd *cobra.Command, args []string) {
20-
// TODO: Work your own magic here
2120
createProgram()
2221
},
2322
}
@@ -33,7 +32,6 @@ Cobra is a CLI library for Go that empowers applications.
3332
This application is a tool to generate the needed files
3433
to quickly create a Cobra application.`,
3534
Run: func(cmd *cobra.Command, args []string) {
36-
// TODO: Work your own magic here
3735
editProgram()
3836
},
3937
}
@@ -49,7 +47,6 @@ Cobra is a CLI library for Go that empowers applications.
4947
This application is a tool to generate the needed files
5048
to quickly create a Cobra application.`,
5149
Run: func(cmd *cobra.Command, args []string) {
52-
// TODO: Work your own magic here
5350
showProgram()
5451
},
5552
}

cmd/root.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ func setWebdir() string {
9898
os.Exit(1)
9999
}
100100
return pwd
101-
} else {
102-
s := os.Getenv("DODPATH")
103-
s = strings.TrimSuffix(s, "/")
104-
s = strings.TrimSuffix(s, "\\")
105-
return s
106101
}
102+
s := os.Getenv("DODPATH")
103+
s = strings.TrimSuffix(s, "/")
104+
s = strings.TrimSuffix(s, "\\")
105+
return s
107106
}

cmd/speaker.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ You can provide the speaker's name as an argument to this command, but it must b
1919
devopsdays-cli add speaker george-bluth -c "New York" --year "2017"`,
2020
Args: cobra.MaximumNArgs(1),
2121
Run: func(cmd *cobra.Command, args []string) {
22-
// TODO: Work your own magic here
2322
addSpeaker()
2423
},
2524
}
@@ -72,7 +71,6 @@ You can provide the speaker's name as an argument to this command, but it must b
7271
devopsdays-cli remove speaker george-bluth -c "New York" --year "2017"`,
7372
Args: cobra.MaximumNArgs(1),
7473
Run: func(cmd *cobra.Command, args []string) {
75-
// TODO: Work your own magic here
7674
removeSpeaker()
7775
},
7876
}
@@ -88,7 +86,6 @@ var showSpeakerCmd = &cobra.Command{
8886
devopsdays-cli show speaker george-bluth -c "New York" --year "2017"`,
8987
Args: cobra.MaximumNArgs(1),
9088
Run: func(cmd *cobra.Command, args []string) {
91-
// TODO: Work your own magic here
9289
showSpeakerPrompt(City, Year)
9390
},
9491
}

cmd/sponsor.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ Cobra is a CLI library for Go that empowers applications.
3636
This application is a tool to generate the needed files
3737
to quickly create a Cobra application.`,
3838
Run: func(cmd *cobra.Command, args []string) {
39-
// TODO: Work your own magic here
40-
addSponsor("") //TODO: This is the fake one
39+
addSponsor("") // This is the fake one
4140
},
4241
}
4342

@@ -71,7 +70,6 @@ Cobra is a CLI library for Go that empowers applications.
7170
This application is a tool to generate the needed files
7271
to quickly edit a Cobra application.`,
7372
Run: func(cmd *cobra.Command, args []string) {
74-
// TODO: Work your own magic here
7573
editSponsor()
7674
},
7775
}
@@ -87,8 +85,7 @@ Cobra is a CLI library for Go that empowers applications.
8785
This application is a tool to generate the needed files
8886
to quickly create a Cobra application.`,
8987
Run: func(cmd *cobra.Command, args []string) {
90-
// TODO: Work your own magic here
91-
removeSponsor() //TODO: This is the fake one
88+
removeSponsor() // This is the fake one
9289
},
9390
}
9491

@@ -103,8 +100,7 @@ Cobra is a CLI library for Go that empowers applications.
103100
This application is a tool to generate the needed files
104101
to quickly create a Cobra application.`,
105102
Run: func(cmd *cobra.Command, args []string) {
106-
// TODO: Work your own magic here
107-
showSponsor() //TODO: This is the fake one
103+
showSponsor() // This is the fake one
108104
},
109105
}
110106

cmd/talk.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Cobra is a CLI library for Go that empowers applications.
1919
This application is a tool to generate the needed files
2020
to quickly create a Cobra application.`,
2121
Run: func(cmd *cobra.Command, args []string) {
22-
// TODO: Work your own magic here
2322
createTalk()
2423
},
2524
}
@@ -35,7 +34,6 @@ Cobra is a CLI library for Go that empowers applications.
3534
This application is a tool to generate the needed files
3635
to quickly create a Cobra application.`,
3736
Run: func(cmd *cobra.Command, args []string) {
38-
// TODO: Work your own magic here
3937
createTalk()
4038
},
4139
}
@@ -51,7 +49,6 @@ Cobra is a CLI library for Go that empowers applications.
5149
This application is a tool to generate the needed files
5250
to quickly create a Cobra application.`,
5351
Run: func(cmd *cobra.Command, args []string) {
54-
// TODO: Work your own magic here
5552
editTalk()
5653
},
5754
}
@@ -67,7 +64,6 @@ Cobra is a CLI library for Go that empowers applications.
6764
This application is a tool to generate the needed files
6865
to quickly create a Cobra application.`,
6966
Run: func(cmd *cobra.Command, args []string) {
70-
// TODO: Work your own magic here
7167
removeTalk()
7268
},
7369
}
@@ -82,7 +78,6 @@ var showTalkCmd = &cobra.Command{
8278
devopsdays-cli show talk --city new-york --year 2017 --all
8379
devopsdays-cli show talk -c "New York" --year "2017"`,
8480
Run: func(cmd *cobra.Command, args []string) {
85-
// TODO: Work your own magic here
8681
showTalkPrompt(City, Year)
8782
},
8883
}

cmd/version.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ import (
1212
)
1313

1414
var (
15+
// Version is the current version of the devopsdays-cli tool. Unless set elsehwere, it is referred to as "master"
1516
Version = "master"
16-
Build string
17+
// Build is the current build of the devopsdays-cli tool.
18+
// @todo The Build variable in cmd/version.go needs to be set somewhere.
19+
Build string
1720
)
1821

1922
func init() {
@@ -55,6 +58,8 @@ func getThemeVersion() (themeVersion string) {
5558

5659
}
5760

61+
// Theme represents the currently installed devopsdays-theme Hugo theme.
62+
// The field Version represents the current version.
5863
type Theme struct {
5964
Version string `toml:"theme_version"`
6065
}

0 commit comments

Comments
 (0)