Skip to content

Commit

Permalink
Merge pull request #275 from lets-cli/improve-help-message
Browse files Browse the repository at this point in the history
improve help message
  • Loading branch information
kindermax authored Jan 28, 2025
2 parents 42a4748 + 29e6e6a commit e79cea5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func InitCompletionCmd(rootCmd *cobra.Command, cfg *config.Config) func(cfg *con
Use: "completion",
Hidden: true,
Short: "Generates completion scripts for bash, zsh",
GroupID: "internal",
RunE: func(cmd *cobra.Command, args []string) error {
shellType, err := cmd.Flags().GetString("shell")
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// newRootCmd represents the base command when called without any subcommands.
func newRootCmd(version string) *cobra.Command {
return &cobra.Command{
cmd := &cobra.Command{
Use: "lets",
Short: "A CLI task runner",
Args: cobra.ArbitraryArgs,
Expand All @@ -24,6 +24,9 @@ func newRootCmd(version string) *cobra.Command {
// print help message manyally
SilenceUsage: true,
}
cmd.AddGroup(&cobra.Group{"main", "Commands:"}, &cobra.Group{"internal", "Internal commands:"})
cmd.SetHelpCommandGroupID("internal")
return cmd
}

// CreateRootCommand used to run only root command without config.
Expand Down
1 change: 1 addition & 0 deletions cmd/self.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func InitSelfCmd(rootCmd *cobra.Command, version string) {
Use: "self",
Hidden: false,
Short: "Manage lets CLI itself",
GroupID: "internal",
RunE: func(cmd *cobra.Command, args []string) error {
return PrintHelpMessage(cmd)
},
Expand Down
1 change: 1 addition & 0 deletions cmd/subcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func newSubcommand(command *config.Command, conf *config.Config, showAll bool, o
subCmd := &cobra.Command{
Use: command.Name,
Short: short(command.Description),
GroupID: "main",
Hidden: isHidden(command.Name, showAll),
RunE: func(cmd *cobra.Command, args []string) error {
command.Args = append(command.Args, prepareArgs(command.Name, os.Args)...)
Expand Down
7 changes: 5 additions & 2 deletions docs/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ title: Changelog

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

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

* `[Added]` `lets self` command that is ment to be a new home for all lets own commands such as `completions` (soon) or `lsp`
* `[Added]` `lets self lsp` command that starts built-in `lsp` server with go to definition support and completions
* [`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.
* `[CI]` reworked release pipeline now supports go cross compilation
* `[Improvment]` split commands in help message into `Commands` and `Internal commands`
* `[Dependency]` update go to `1.23`
* `[Dependency]` update goreleaser to `2.x`
* `[Dependency]` update goreleaser to `1.63.x`
* `[Dependency]` update golangci-lint to `2.x` (also applied some lint fixes across codebase)

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

Expand Down
8 changes: 6 additions & 2 deletions tests/help.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ Usage:
lets [flags]
lets [command]
Available Commands:
Commands:
bar Print bar
foo Print foo
Internal commands:
help Help about any command
self Manage lets CLI itself
Expand Down Expand Up @@ -43,10 +45,12 @@ Usage:
lets [flags]
lets [command]
Available Commands:
Commands:
_x Hidden x
bar Print bar
foo Print foo
Internal commands:
help Help about any command
self Manage lets CLI itself
Expand Down

0 comments on commit e79cea5

Please sign in to comment.