mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
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
This commit is contained in:
@@ -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{}
|
||||
|
||||
return site.Analyze()
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
initCoreCommonFlags(checkCmd)
|
||||
checkCmd.RunE = check
|
||||
}
|
||||
|
||||
func check(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(checkCmd); err != nil {
|
||||
return err
|
||||
}
|
||||
site := hugolib.Site{}
|
||||
|
||||
return site.Analyze()
|
||||
}
|
||||
|
Reference in New Issue
Block a user