commands

package
v0.0.0-...-206440e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2016 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var HugoCmd = &cobra.Command{
	Use:   "hugo",
	Short: "hugo builds your site",
	Long: `hugo is the main command, used to build your Hugo site.

Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.

Complete documentation is available at http://gohugo.io/.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		if err := InitializeConfig(); err != nil {
			return err
		}

		if buildWatch {
			viper.Set("DisableLiveReload", true)
			watchConfig()
		}

		return build()
	},
}

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

View Source
var MainSite *hugolib.Site

MainSite represents the Hugo site 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.

Functions

func AddCommands

func AddCommands()

AddCommands adds child commands to the root command HugoCmd.

func Execute

func Execute()

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

func InitializeConfig

func InitializeConfig(subCmdVs ...*cobra.Command) error

InitializeConfig initializes a config file with sensible default configuration flags. A Hugo command that calls initCoreCommonFlags() can pass itself as an argument to have its command-line flags processed here.

func NewContent

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

NewContent adds new content to a Hugo site.

func NewSite

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

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

func NewTheme

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

NewTheme creates a new Hugo theme.

func NewWatcher

func NewWatcher(port int) error

NewWatcher creates a new watcher to watch filesystem events.

func Undraft

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL