Skip to content

Commit e79cea5

Browse files
authored
Merge pull request #275 from lets-cli/improve-help-message
improve help message
2 parents 42a4748 + 29e6e6a commit e79cea5

6 files changed

Lines changed: 18 additions & 5 deletions

File tree

cmd/completion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func InitCompletionCmd(rootCmd *cobra.Command, cfg *config.Config) func(cfg *con
187187
Use: "completion",
188188
Hidden: true,
189189
Short: "Generates completion scripts for bash, zsh",
190+
GroupID: "internal",
190191
RunE: func(cmd *cobra.Command, args []string) error {
191192
shellType, err := cmd.Flags().GetString("shell")
192193
if err != nil {

cmd/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
// newRootCmd represents the base command when called without any subcommands.
1111
func newRootCmd(version string) *cobra.Command {
12-
return &cobra.Command{
12+
cmd := &cobra.Command{
1313
Use: "lets",
1414
Short: "A CLI task runner",
1515
Args: cobra.ArbitraryArgs,
@@ -24,6 +24,9 @@ func newRootCmd(version string) *cobra.Command {
2424
// print help message manyally
2525
SilenceUsage: true,
2626
}
27+
cmd.AddGroup(&cobra.Group{"main", "Commands:"}, &cobra.Group{"internal", "Internal commands:"})
28+
cmd.SetHelpCommandGroupID("internal")
29+
return cmd
2730
}
2831

2932
// CreateRootCommand used to run only root command without config.

cmd/self.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ func InitSelfCmd(rootCmd *cobra.Command, version string) {
1010
Use: "self",
1111
Hidden: false,
1212
Short: "Manage lets CLI itself",
13+
GroupID: "internal",
1314
RunE: func(cmd *cobra.Command, args []string) error {
1415
return PrintHelpMessage(cmd)
1516
},

cmd/subcommand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ func newSubcommand(command *config.Command, conf *config.Config, showAll bool, o
159159
subCmd := &cobra.Command{
160160
Use: command.Name,
161161
Short: short(command.Description),
162+
GroupID: "main",
162163
Hidden: isHidden(command.Name, showAll),
163164
RunE: func(cmd *cobra.Command, args []string) error {
164165
command.Args = append(command.Args, prepareArgs(command.Name, os.Args)...)

docs/docs/changelog.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ title: Changelog
55

66
## [Unreleased](https://github.com/lets-cli/lets/releases/tag/v0.0.X)
77

8-
## [0.0.55](https://github.com/lets-cli/lets/releases/tag/v0.0.54)
8+
## [0.0.55](https://github.com/lets-cli/lets/releases/tag/v0.0.55)
99

1010
* `[Added]` `lets self` command that is ment to be a new home for all lets own commands such as `completions` (soon) or `lsp`
1111
* `[Added]` `lets self lsp` command that starts built-in `lsp` server with go to definition support and completions
1212
* [`Development`] Since `lsp` implementation uses `https://tree-sitter.github.io` (C library with go bindings) as a internal parser `lets` now build with `CGO_ENABLED=1`. If you are building on local machine, you do not have to specify `CGO_ENABLED` env variable. But you may have to install some build system dependencies in case compilatino fails.
13+
* `[CI]` reworked release pipeline now supports go cross compilation
14+
* `[Improvment]` split commands in help message into `Commands` and `Internal commands`
1315
* `[Dependency]` update go to `1.23`
14-
* `[Dependency]` update goreleaser to `2.x`
16+
* `[Dependency]` update goreleaser to `1.63.x`
17+
* `[Dependency]` update golangci-lint to `2.x` (also applied some lint fixes across codebase)
1518

1619
## [0.0.54](https://github.com/lets-cli/lets/releases/tag/v0.0.54)
1720

tests/help.bats

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ Usage:
1313
lets [flags]
1414
lets [command]
1515
16-
Available Commands:
16+
Commands:
1717
bar Print bar
1818
foo Print foo
19+
20+
Internal commands:
1921
help Help about any command
2022
self Manage lets CLI itself
2123
@@ -43,10 +45,12 @@ Usage:
4345
lets [flags]
4446
lets [command]
4547
46-
Available Commands:
48+
Commands:
4749
_x Hidden x
4850
bar Print bar
4951
foo Print foo
52+
53+
Internal commands:
5054
help Help about any command
5155
self Manage lets CLI itself
5256

0 commit comments

Comments
 (0)