From 6b5e117a1213eecf1320aad292a0979c67f5179d Mon Sep 17 00:00:00 2001 From: Rohan Hasabe Date: Sun, 13 Oct 2024 22:10:38 -0400 Subject: [PATCH] commands: Use consistent style when describing subcommands Closes #12897 Change-Id: Ib27a4a7b540d45243e6252db769d4b9fb7447718 Signed-off-by: Rohan Hasabe --- commands/commandeer.go | 2 +- commands/config.go | 4 ++-- commands/convert.go | 4 ++-- commands/deploy.go | 4 ++-- commands/env.go | 8 ++++---- commands/gen.go | 3 ++- commands/import.go | 4 ++-- commands/list.go | 4 ++-- commands/mod.go | 2 +- commands/new.go | 4 ++-- commands/server.go | 2 +- testscripts/commands/config.txt | 2 +- testscripts/commands/convert.txt | 2 +- testscripts/commands/deploy.txt | 2 +- testscripts/commands/gen.txt | 2 +- testscripts/commands/import_jekyll.txt | 4 ++-- 16 files changed, 27 insertions(+), 26 deletions(-) diff --git a/commands/commandeer.go b/commands/commandeer.go index 841e8d81c..06565d45d 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -509,7 +509,7 @@ func (r *rootCommand) initRootCommand(subCommandName string, cd *simplecobra.Com commandName = subCommandName } cmd.Use = fmt.Sprintf("%s [flags]", commandName) - cmd.Short = fmt.Sprintf("%s builds your site", commandName) + cmd.Short = "Build your site" cmd.Long = `COMMAND_NAME is the main command, used to build your Hugo site. Hugo is a Fast and Flexible Static Site Generator diff --git a/commands/config.go b/commands/config.go index c3d08ae22..b250fc329 100644 --- a/commands/config.go +++ b/commands/config.go @@ -110,8 +110,8 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg func (c *configCommand) Init(cd *simplecobra.Commandeer) error { c.r = cd.Root.Command.(*rootCommand) cmd := cd.CobraCommand - cmd.Short = "Print the site configuration" - cmd.Long = `Print the site configuration, both default and custom settings.` + cmd.Short = "Display site configuration" + cmd.Long = `Display site configuration, both default and custom settings.` cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)") _ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp)) cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.") diff --git a/commands/convert.go b/commands/convert.go index 4e1ceb7d1..ebf81cfb3 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -105,8 +105,8 @@ func (c *convertCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, ar func (c *convertCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "Convert your content to different formats" - cmd.Long = `Convert your content (e.g. front matter) to different formats. + cmd.Short = "Convert front matter to another format" + cmd.Long = `Convert front matter to another format. See convert's subcommands toJSON, toTOML and toYAML for more information.` diff --git a/commands/deploy.go b/commands/deploy.go index 873da14a4..f0bc670ca 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -42,8 +42,8 @@ import ( func newDeployCommand() simplecobra.Commander { return &simpleCommand{ name: "deploy", - short: "Deploy your site to a Cloud provider.", - long: `Deploy your site to a Cloud provider. + short: "Deploy your site to a cloud provider", + long: `Deploy your site to a cloud provider See https://gohugo.io/hosting-and-deployment/hugo-deploy/ for detailed documentation. diff --git a/commands/env.go b/commands/env.go index 843fc49d1..753522560 100644 --- a/commands/env.go +++ b/commands/env.go @@ -25,8 +25,8 @@ import ( func newEnvCommand() simplecobra.Commander { return &simpleCommand{ name: "env", - short: "Print Hugo version and environment info", - long: "Print Hugo version and environment info. This is useful in Hugo bug reports", + short: "Display version and environment info", + long: "Display version and environment info. This is useful in Hugo bug reports", run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error { r.Printf("%s\n", hugo.BuildVersionString()) r.Printf("GOOS=%q\n", runtime.GOOS) @@ -61,8 +61,8 @@ func newVersionCmd() simplecobra.Commander { r.Println(hugo.BuildVersionString()) return nil }, - short: "Print Hugo version and environment info", - long: "Print Hugo version and environment info. This is useful in Hugo bug reports.", + short: "Display version", + long: "Display version and environment info. This is useful in Hugo bug reports.", withc: func(cmd *cobra.Command, r *rootCommand) { cmd.ValidArgsFunction = cobra.NoFileCompletions }, diff --git a/commands/gen.go b/commands/gen.go index b6ace80d9..83b4d637c 100644 --- a/commands/gen.go +++ b/commands/gen.go @@ -273,7 +273,8 @@ func (c *genCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [ func (c *genCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "A collection of several useful generators." + cmd.Short = "Generate documentation and syntax highlighting styles" + cmd.Long = "Generate documentation for your project using Hugo's documentation engine, including syntax highlighting for various programming languages." cmd.RunE = nil return nil diff --git a/commands/import.go b/commands/import.go index c2d574aa1..37a6b0dbf 100644 --- a/commands/import.go +++ b/commands/import.go @@ -90,8 +90,8 @@ func (c *importCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg func (c *importCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "Import your site from others." - cmd.Long = `Import your site from other web site generators like Jekyll. + cmd.Short = "Import a site from another system" + cmd.Long = `Import a site from another system. Import requires a subcommand, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`." diff --git a/commands/list.go b/commands/list.go index c2f9c2d87..f362e22f1 100644 --- a/commands/list.go +++ b/commands/list.go @@ -199,8 +199,8 @@ func (c *listCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args func (c *listCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "Listing out various types of content" - cmd.Long = `Listing out various types of content. + cmd.Short = "List content" + cmd.Long = `List content. List requires a subcommand, e.g. hugo list drafts` diff --git a/commands/mod.go b/commands/mod.go index a9c8c459d..dda7840cc 100644 --- a/commands/mod.go +++ b/commands/mod.go @@ -328,7 +328,7 @@ func (c *modCommands) Run(ctx context.Context, cd *simplecobra.Commandeer, args func (c *modCommands) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "Various Hugo Modules helpers." + cmd.Short = "Manage modules" cmd.Long = `Various helpers to help manage the modules in your project's dependency graph. Most operations here requires a Go version installed on your system (>= Go 1.12) and the relevant VCS client (typically Git). This is not needed if you only operate on modules inside /themes or if you have vendored them via "hugo mod vendor". diff --git a/commands/new.go b/commands/new.go index f6bb09e00..901ea02d6 100644 --- a/commands/new.go +++ b/commands/new.go @@ -40,7 +40,7 @@ func newNewCommand() *newCommand { &simpleCommand{ name: "content", use: "content [path]", - short: "Create new content for your site", + short: "Create new content", 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. @@ -181,7 +181,7 @@ func (c *newCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [ func (c *newCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "Create new content for your site" + cmd.Short = "Create new content" cmd.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. diff --git a/commands/server.go b/commands/server.go index 680c73a13..b16bf3148 100644 --- a/commands/server.go +++ b/commands/server.go @@ -508,7 +508,7 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg func (c *serverCommand) Init(cd *simplecobra.Commandeer) error { cmd := cd.CobraCommand - cmd.Short = "A high performance webserver" + cmd.Short = "Start the embedded web server" cmd.Long = `Hugo provides its own webserver which builds and serves the site. While hugo server is high performance, it is a webserver with limited options. diff --git a/testscripts/commands/config.txt b/testscripts/commands/config.txt index b1dba8d11..46386eb92 100644 --- a/testscripts/commands/config.txt +++ b/testscripts/commands/config.txt @@ -1,7 +1,7 @@ # Test the config command. hugo config -h -stdout 'Print the site configuration' +stdout 'Display site configuration' hugo config diff --git a/testscripts/commands/convert.txt b/testscripts/commands/convert.txt index 1cf756215..811aeecc8 100644 --- a/testscripts/commands/convert.txt +++ b/testscripts/commands/convert.txt @@ -1,7 +1,7 @@ # Test the convert commands. hugo convert -h -stdout 'Convert your content' +stdout 'Convert front matter to another format' hugo convert toJSON -h stdout 'to use JSON for the front matter' hugo convert toTOML -h diff --git a/testscripts/commands/deploy.txt b/testscripts/commands/deploy.txt index 0afe1fc44..2586f8b8f 100644 --- a/testscripts/commands/deploy.txt +++ b/testscripts/commands/deploy.txt @@ -1,7 +1,7 @@ # Test the deploy command. hugo deploy -h -stdout 'Deploy your site to a Cloud provider\.' +stdout 'Deploy your site to a cloud provider' mkdir mybucket hugo deploy --target mydeployment --invalidateCDN=false grep 'hello' mybucket/index.html diff --git a/testscripts/commands/gen.txt b/testscripts/commands/gen.txt index 16db9fe4a..b8fe9d2dc 100644 --- a/testscripts/commands/gen.txt +++ b/testscripts/commands/gen.txt @@ -3,7 +3,7 @@ env NUM_COMMANDS=44 hugo gen -h -stdout 'A collection of several useful generators\.' +stdout 'Generate documentation for your project using Hugo''s documentation engine, including syntax highlighting for various programming languages\.' hugo gen doc --dir clidocs checkfilecount $NUM_COMMANDS clidocs diff --git a/testscripts/commands/import_jekyll.txt b/testscripts/commands/import_jekyll.txt index 8d229ba2e..953349acf 100644 --- a/testscripts/commands/import_jekyll.txt +++ b/testscripts/commands/import_jekyll.txt @@ -1,7 +1,7 @@ -# Test the import jekyll command. +# Test the import + import jekyll command. hugo import -h -stdout 'Import your site from other web site generators like Jekyll\.' +stdout 'Import a site from another system' hugo import jekyll -h stdout 'hugo import from Jekyll\.'