mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
08670e6a47
commit
eebf00f702
1 changed files with 24 additions and 24 deletions
|
@ -93,7 +93,7 @@ func isUserError(err error) bool {
|
||||||
|
|
||||||
// HugoCmd is Hugo's root command.
|
// HugoCmd is Hugo's root command.
|
||||||
// Every other command attached to HugoCmd is a child command to it.
|
// Every other command attached to HugoCmd is a child command to it.
|
||||||
var hugoCmd = &cobra.Command{
|
var HugoCmd = &cobra.Command{
|
||||||
Use: "hugo",
|
Use: "hugo",
|
||||||
Short: "hugo builds your site",
|
Short: "hugo builds your site",
|
||||||
Long: `hugo is the main command, used to build your Hugo site.
|
Long: `hugo is the main command, used to build your Hugo site.
|
||||||
|
@ -152,13 +152,13 @@ var (
|
||||||
|
|
||||||
// Execute adds all child commands to the root command HugoCmd and sets flags appropriately.
|
// Execute adds all child commands to the root command HugoCmd and sets flags appropriately.
|
||||||
func Execute() {
|
func Execute() {
|
||||||
hugoCmd.SetGlobalNormalizationFunc(helpers.NormalizeHugoFlags)
|
HugoCmd.SetGlobalNormalizationFunc(helpers.NormalizeHugoFlags)
|
||||||
|
|
||||||
hugoCmd.SilenceUsage = true
|
HugoCmd.SilenceUsage = true
|
||||||
|
|
||||||
AddCommands()
|
AddCommands()
|
||||||
|
|
||||||
if c, err := hugoCmd.ExecuteC(); err != nil {
|
if c, err := HugoCmd.ExecuteC(); err != nil {
|
||||||
if isUserError(err) {
|
if isUserError(err) {
|
||||||
c.Println("")
|
c.Println("")
|
||||||
c.Println(c.UsageString())
|
c.Println(c.UsageString())
|
||||||
|
@ -170,18 +170,18 @@ func Execute() {
|
||||||
|
|
||||||
// AddCommands adds child commands to the root command HugoCmd.
|
// AddCommands adds child commands to the root command HugoCmd.
|
||||||
func AddCommands() {
|
func AddCommands() {
|
||||||
hugoCmd.AddCommand(serverCmd)
|
HugoCmd.AddCommand(serverCmd)
|
||||||
hugoCmd.AddCommand(versionCmd)
|
HugoCmd.AddCommand(versionCmd)
|
||||||
hugoCmd.AddCommand(configCmd)
|
HugoCmd.AddCommand(configCmd)
|
||||||
hugoCmd.AddCommand(checkCmd)
|
HugoCmd.AddCommand(checkCmd)
|
||||||
hugoCmd.AddCommand(benchmarkCmd)
|
HugoCmd.AddCommand(benchmarkCmd)
|
||||||
hugoCmd.AddCommand(convertCmd)
|
HugoCmd.AddCommand(convertCmd)
|
||||||
hugoCmd.AddCommand(newCmd)
|
HugoCmd.AddCommand(newCmd)
|
||||||
hugoCmd.AddCommand(listCmd)
|
HugoCmd.AddCommand(listCmd)
|
||||||
hugoCmd.AddCommand(undraftCmd)
|
HugoCmd.AddCommand(undraftCmd)
|
||||||
hugoCmd.AddCommand(importCmd)
|
HugoCmd.AddCommand(importCmd)
|
||||||
|
|
||||||
hugoCmd.AddCommand(genCmd)
|
HugoCmd.AddCommand(genCmd)
|
||||||
genCmd.AddCommand(genautocompleteCmd)
|
genCmd.AddCommand(genautocompleteCmd)
|
||||||
genCmd.AddCommand(gendocCmd)
|
genCmd.AddCommand(gendocCmd)
|
||||||
genCmd.AddCommand(genmanCmd)
|
genCmd.AddCommand(genmanCmd)
|
||||||
|
@ -238,19 +238,19 @@ func initBenchmarkBuildingFlags(cmd *cobra.Command) {
|
||||||
|
|
||||||
// init initializes flags.
|
// init initializes flags.
|
||||||
func init() {
|
func init() {
|
||||||
hugoCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
|
HugoCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
|
||||||
hugoCmd.PersistentFlags().BoolVar(&logging, "log", false, "Enable Logging")
|
HugoCmd.PersistentFlags().BoolVar(&logging, "log", false, "Enable Logging")
|
||||||
hugoCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "Log File path (if set, logging enabled automatically)")
|
HugoCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "Log File path (if set, logging enabled automatically)")
|
||||||
hugoCmd.PersistentFlags().BoolVar(&verboseLog, "verboseLog", false, "verbose logging")
|
HugoCmd.PersistentFlags().BoolVar(&verboseLog, "verboseLog", false, "verbose logging")
|
||||||
|
|
||||||
initHugoBuilderFlags(hugoCmd)
|
initHugoBuilderFlags(HugoCmd)
|
||||||
initBenchmarkBuildingFlags(hugoCmd)
|
initBenchmarkBuildingFlags(HugoCmd)
|
||||||
|
|
||||||
hugoCmd.Flags().BoolVarP(&buildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
|
HugoCmd.Flags().BoolVarP(&buildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
|
||||||
hugoCmdV = hugoCmd
|
hugoCmdV = HugoCmd
|
||||||
|
|
||||||
// For bash-completion
|
// For bash-completion
|
||||||
hugoCmd.PersistentFlags().SetAnnotation("logFile", cobra.BashCompFilenameExt, []string{})
|
HugoCmd.PersistentFlags().SetAnnotation("logFile", cobra.BashCompFilenameExt, []string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadDefaultSettings() {
|
func LoadDefaultSettings() {
|
||||||
|
|
Loading…
Reference in a new issue