nushell / nushell/nushell

Show help for custom subcommands by default if parent command is not defined

Open
#7,642 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A:help-system A:scoping/name-resolution category:enhancement
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Related problem

Imagine I want to define new commands that are actually subcommands for non-existing command

def 'service start' () {}

def 'service stop' () {}

Calls to service start, service stop will work fine, but call to service will fail with No such file.

In order to provide some guide when calling service I can define parent command with next code:

def service () {
  help service
}

And with that after calling service I'll get the help for subcommands

Describe the solution you'd like

Provide default parent command that will show help message if some of subcommands were provided. In case the parent command is defined, use it instead of default.

Describe alternatives you've considered

I can implement that manually every time I define subcommands, but this will be tedious.

Additional context and details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Nushell's custom subcommand resolution for calls such as service start and the existing help service behavior. Define the fallback behavior when service has subcommands but no parent command, while preserving an explicitly defined parent command, and verify both cases with focused command-dispatch tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.