summaryrefslogtreecommitdiffstats
path: root/commands/check.go
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2015-12-02 12:00:47 -0700
committerAnthony Fok <foka@debian.org>2015-12-03 00:36:38 -0700
commit00d04774f0d9789262557af6a6465d8b6271839d (patch)
tree6ac014c9a651962d6bd17d31aa69a720aed9c599 /commands/check.go
parentc9526f6e3fdffe9e583e11d3513faa392576c305 (diff)
Change most global flags into local ones
This is to ensure that only the relevant command-line flags for a certain Hugo subcommand is shown to the end user, reducing clutter and improving user experience. Fixes #1624 - CLI UX: Flags shouldn't be global
Diffstat (limited to 'commands/check.go')
-rw-r--r--commands/check.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/commands/check.go b/commands/check.go
index 59188dc90..e78145fdf 100644
--- a/commands/check.go
+++ b/commands/check.go
@@ -23,13 +23,18 @@ var checkCmd = &cobra.Command{
Short: "Check content in the source directory",
Long: `Hugo will perform some basic analysis on the content provided
and will give feedback.`,
- RunE: func(cmd *cobra.Command, args []string) error {
- if err := InitializeConfig(); err != nil {
- return err
- }
- site := hugolib.Site{}
+}
+
+func init() {
+ initCoreCommonFlags(checkCmd)
+ checkCmd.RunE = check
+}
- return site.Analyze()
+func check(cmd *cobra.Command, args []string) error {
+ if err := InitializeConfig(checkCmd); err != nil {
+ return err
+ }
+ site := hugolib.Site{}
- },
+ return site.Analyze()
}