hugo: github.com/gohugoio/hugo/commands Index | Files

package commands

import "github.com/gohugoio/hugo/commands"

Package commands defines and implements command-line commands and flags used by Hugo. Commands and flags are implemented using Cobra.

Index

Package Files

benchmark.go check.go commandeer.go convert.go env.go gen.go genautocomplete.go gendoc.go gendocshelper.go genman.go hugo.go import_jekyll.go limit_others.go list.go list_config.go new.go server.go undraft.go version.go

Variables

var Hugo *hugolib.HugoSites

Hugo represents the Hugo sites to build. This variable is exported as it is used by at least one external library (the Hugo caddy plugin). We should provide a cleaner external API, but until then, this is it.

var HugoCmd = &cobra.Command{
    Use:   "hugo",
    Short: "hugo builds your site",
    Long:  "" /* 211 byte string literal not displayed */,

    RunE: func(cmd *cobra.Command, args []string) error {
        cfg, err := InitializeConfig()
        if err != nil {
            return err
        }

        c, err := newCommandeer(cfg)
        if err != nil {
            return err
        }

        if buildWatch {
            cfg.Cfg.Set("disableLiveReload", true)
            c.watchConfig()
        }

        return c.build()
    },
}

HugoCmd is Hugo's root command. Every other command attached to HugoCmd is a child command to it.

func AddCommands Uses

func AddCommands()

AddCommands adds child commands to the root command HugoCmd.

func Execute Uses

func Execute()

Execute adds all child commands to the root command HugoCmd and sets flags appropriately.

func InitializeConfig Uses

func InitializeConfig(subCmdVs ...*cobra.Command) (*deps.DepsCfg, error)

InitializeConfig initializes a config file with sensible default configuration flags.

func NewContent Uses

func NewContent(cmd *cobra.Command, args []string) error

NewContent adds new content to a Hugo site.

func NewSite Uses

func NewSite(cmd *cobra.Command, args []string) error

NewSite creates a new Hugo site and initializes a structured Hugo directory.

func NewTheme Uses

func NewTheme(cmd *cobra.Command, args []string) error

NewTheme creates a new Hugo theme.

func Reset Uses

func Reset() error

Reset resets Hugo ready for a new full build. This is mainly only useful for benchmark testing etc. via the CLI commands.

func Undraft Uses

func Undraft(cmd *cobra.Command, args []string) error

Undraft publishes the specified content by setting its draft status to false and setting its publish date to now. If the specified content is not a draft, it will log an error.

Package commands imports 44 packages (graph) and is imported by 1 packages. Updated 2017-06-22. Refresh now. Tools for package owners.