Improve formatting of Hugo command descriptions

Trying to make them look good both in the terminal (`hugo help [command]`)
and in the web browser (http://gohugo.io/commands/).  :-)
This commit is contained in:
Anthony Fok
2015-08-04 03:15:12 -06:00
parent e64e571b67
commit f2ab0b2608
31 changed files with 432 additions and 388 deletions

View File

@@ -25,9 +25,9 @@ var benchmarkTimes int
var benchmark = &cobra.Command{
Use: "benchmark",
Short: "Benchmark hugo by building a site a number of times",
Long: `Hugo can build a site many times over and analyze the
running process creating a benchmark.`,
Short: "Benchmark hugo by building a site a number of times.",
Long: `Hugo can build a site many times over and analyze the running process
creating a benchmark.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()
bench(cmd, args)

View File

@@ -21,8 +21,8 @@ import (
var check = &cobra.Command{
Use: "check",
Short: "Check content in the source directory",
Long: `Hugo will perform some basic analysis on the
content provided and will give feedback.`,
Long: `Hugo will perform some basic analysis on the content provided
and will give feedback.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()
site := hugolib.Site{}

View File

@@ -32,16 +32,18 @@ var unsafe bool
var convertCmd = &cobra.Command{
Use: "convert",
Short: "Convert will modify your content to different formats",
Long: `Convert will modify your content to different formats`,
Short: "Convert your content to different formats",
Long: `Convert your content (e.g. front matter) to different formats.
See convert's subcommands toJSON, toTOML and toYAML for more information.`,
Run: nil,
}
var toJSONCmd = &cobra.Command{
Use: "toJSON",
Short: "Convert front matter to JSON",
Long: `toJSON will convert all front matter in the content
directory to use JSON for the front matter`,
Long: `toJSON converts all front matter in the content directory
to use JSON for the front matter.`,
Run: func(cmd *cobra.Command, args []string) {
err := convertContents(rune([]byte(parser.JSON_LEAD)[0]))
if err != nil {
@@ -53,8 +55,8 @@ var toJSONCmd = &cobra.Command{
var toTOMLCmd = &cobra.Command{
Use: "toTOML",
Short: "Convert front matter to TOML",
Long: `toTOML will convert all front matter in the content
directory to use TOML for the front matter`,
Long: `toTOML converts all front matter in the content directory
to use TOML for the front matter.`,
Run: func(cmd *cobra.Command, args []string) {
err := convertContents(rune([]byte(parser.TOML_LEAD)[0]))
if err != nil {
@@ -66,8 +68,8 @@ var toTOMLCmd = &cobra.Command{
var toYAMLCmd = &cobra.Command{
Use: "toYAML",
Short: "Convert front matter to YAML",
Long: `toYAML will convert all front matter in the content
directory to use YAML for the front matter`,
Long: `toYAML converts all front matter in the content directory
to use YAML for the front matter.`,
Run: func(cmd *cobra.Command, args []string) {
err := convertContents(rune([]byte(parser.YAML_LEAD)[0]))
if err != nil {

View File

@@ -14,19 +14,23 @@ var genautocompleteCmd = &cobra.Command{
Use: "genautocomplete",
Short: "Generate shell autocompletion script for Hugo",
Long: `Generates a shell autocompletion script for Hugo.
NOTE: The current version supports Bash only. This should work for *nix systems with Bash installed.
By default the file is written directly to /etc/bash_completion.d for convenience and the command may need superuser rights, e.g:
sudo hugo genautocomplete
Add --completionfile=/path/to/file flag to set alternative file-path and name.
Logout and in again to reload the completion scripts or just source them in directly:
. /etc/bash_completion
`,
NOTE: The current version supports Bash only.
This should work for *nix systems with Bash installed.
By default, the file is written directly to /etc/bash_completion.d
for convenience, and the command may need superuser rights, e.g.:
$ sudo hugo genautocomplete
Add ` + "`--completionfile=/path/to/file`" + ` flag to set alternative
file-path and name.
Logout and in again to reload the completion scripts,
or just source them in directly:
$ . /etc/bash_completion`,
Run: func(cmd *cobra.Command, args []string) {
if autocompleteType != "bash" {
jww.FATAL.Fatalln("Only Bash is supported for now")

View File

@@ -24,11 +24,12 @@ var gendocCmd = &cobra.Command{
Use: "gendoc",
Short: "Generate Markdown documentation for the Hugo CLI.",
Long: `Generate Markdown documentation for the Hugo CLI.
This command is, mostly, used to create up-to-date documentation for gohugo.io.
It creates one Markdown file per command with front matter suitable for rendering in Hugo.
`,
This command is, mostly, used to create up-to-date documentation
of Hugo's command-line interface for http://gohugo.io/.
It creates one Markdown file per command with front matter suitable
for rendering in Hugo.`,
Run: func(cmd *cobra.Command, args []string) {
if !strings.HasSuffix(gendocdir, helpers.FilePathSeparator) {

View File

@@ -43,11 +43,12 @@ import (
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.
Long: `hugo is the main command, used to build your Hugo site.
Complete documentation is available at http://gohugo.io`,
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/.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()
build()

View File

@@ -30,14 +30,16 @@ func init() {
var listCmd = &cobra.Command{
Use: "list",
Short: "Listing out various types of content",
Long: `Listing out various types of content. List requires a subcommand, eg. hugo list drafts`,
Long: `Listing out various types of content.
List requires a subcommand, e.g. ` + "`hugo list drafts`.",
Run: nil,
}
var listDraftsCmd = &cobra.Command{
Use: "drafts",
Short: "List all drafts",
Long: `List all of the drafts in your content directory`,
Long: `List all of the drafts in your content directory.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()
@@ -62,7 +64,8 @@ var listDraftsCmd = &cobra.Command{
var listFutureCmd = &cobra.Command{
Use: "future",
Short: "List all posts dated in the future",
Long: `List all of the posts in your content directory who will be posted in the future`,
Long: `List all of the posts in your content directory which will be
posted in the future.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()

View File

@@ -24,7 +24,7 @@ import (
var config = &cobra.Command{
Use: "config",
Short: "Print the site configuration",
Long: `Print the site configuration, both default and custom settings`,
Long: `Print the site configuration, both default and custom settings.`,
Run: func(cmd *cobra.Command, args []string) {
InitializeConfig()
allSettings := viper.AllSettings()

View File

@@ -48,9 +48,11 @@ var newCmd = &cobra.Command{
Short: "Create new content for your site",
Long: `Create a new content file and automatically set the date and title.
It will guess which kind of file to create based on the path provided.
You can also specify the kind with -k KIND
If archetypes are provided in your theme or site, they will be used.
`,
You can also specify the kind with ` + "`-k KIND`" + `.
If archetypes are provided in your theme or site, they will be used.`,
Run: NewContent,
}
@@ -59,8 +61,7 @@ var newSiteCmd = &cobra.Command{
Short: "Create a new site (skeleton)",
Long: `Create a new site in the provided directory.
The new site will have the correct structure, but no content or theme yet.
Use 'hugo new [contentPath]' to create new content.
`,
Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
Run: NewSite,
}
@@ -70,8 +71,7 @@ var newThemeCmd = &cobra.Command{
Long: `Create a new theme (skeleton) called [name] in the current directory.
New theme is a skeleton. Please add content to the touched files. Add your
name to the copyright line in the license and adjust the theme.toml file
as you see fit.
`,
as you see fit.`,
Run: NewTheme,
}

View File

@@ -26,7 +26,9 @@ import (
var undraftCmd = &cobra.Command{
Use: "undraft path/to/content",
Short: "Undraft changes the content's draft status from 'True' to 'False'",
Long: `Undraft changes the content's draft status from 'True' to 'False' and updates the date to the current date and time. If the content's draft status is 'False', nothing is done`,
Long: `Undraft changes the content's draft status from 'True' to 'False'
and updates the date to the current date and time.
If the content's draft status is 'False', nothing is done.`,
Run: Undraft,
}

View File

@@ -31,7 +31,7 @@ var timeLayout string // the layout for time.Time
var version = &cobra.Command{
Use: "version",
Short: "Print the version number of Hugo",
Long: `All software has versions. This is Hugo's`,
Long: `All software has versions. This is Hugo's.`,
Run: func(cmd *cobra.Command, args []string) {
if hugolib.BuildDate == "" {
setBuildDate() // set the build date from executable's mdate