shithub: hugo

Download patch

ref: b11838da3f431ae2a728257a86481455021f9b84
parent: 9b04c279984cd236c623e8fe52603c9e6ac9d486
author: Ahsanul Haque <[email protected]>
date: Thu Dec 11 19:05:02 EST 2014

Commented commands package

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -11,6 +11,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//Package commands defines and implements command-line commands and flags used by Hugo. Commands and flags are implemented using
+//cobra.
 package commands
 
 import (
@@ -36,7 +38,7 @@
 	"github.com/spf13/viper"
 )
 
-//var Config *hugolib.Config
+//HugoCmd is Hugo's root command. Every other command attached to HugoCmd is a child command to it.
 var HugoCmd = &cobra.Command{
 	Use:   "hugo",
 	Short: "Hugo is a very fast static site generator",
@@ -52,14 +54,17 @@
 
 var hugoCmdV *cobra.Command
 
+//Flags that are to be added to commands.
 var BuildWatch, Draft, Future, UglyUrls, Verbose, Logging, VerboseLog, DisableRSS, DisableSitemap, PluralizeListTitles, NoTimes bool
 var Source, Destination, Theme, BaseUrl, CfgFile, LogFile string
 
+//Execute adds all child commands to the root command HugoCmd and sets flags appropriately.
 func Execute() {
 	AddCommands()
 	utils.StopOnErr(HugoCmd.Execute())
 }
 
+//AddCommands adds child commands to the root command HugoCmd.
 func AddCommands() {
 	HugoCmd.AddCommand(serverCmd)
 	HugoCmd.AddCommand(version)
@@ -70,6 +75,7 @@
 	HugoCmd.AddCommand(listCmd)
 }
 
+//Initializes flags
 func init() {
 	HugoCmd.PersistentFlags().BoolVarP(&Draft, "buildDrafts", "D", false, "include content marked as draft")
 	HugoCmd.PersistentFlags().BoolVarP(&Future, "buildFuture", "F", false, "include content with datePublished in the future")
@@ -92,6 +98,7 @@
 	hugoCmdV = HugoCmd
 }
 
+// InitializeConfig initializes a config file with sensible default configuration flags.
 func InitializeConfig() {
 	viper.SetConfigFile(CfgFile)
 	viper.AddConfigPath(Source)
@@ -297,6 +304,7 @@
 	return nil
 }
 
+//NewWatcher creates a new watcher to watch filesystem events.
 func NewWatcher(port int) error {
 	if runtime.GOOS == "darwin" {
 		tweakLimit()
--- a/commands/new.go
+++ b/commands/new.go
@@ -72,6 +72,7 @@
 	Run: NewTheme,
 }
 
+//NewContent adds new content to a Hugo site.
 func NewContent(cmd *cobra.Command, args []string) {
 	InitializeConfig()
 
@@ -103,6 +104,7 @@
 	}
 }
 
+// NewSite creates a new hugo site and initializes a structured Hugo directory.
 func NewSite(cmd *cobra.Command, args []string) {
 	if len(args) < 1 {
 		cmd.Usage()
@@ -132,6 +134,7 @@
 	createConfig(createpath, configFormat)
 }
 
+//NewTheme creates a new Hugo theme.
 func NewTheme(cmd *cobra.Command, args []string) {
 	InitializeConfig()