Skip to content

Utilize ShellName and Add Test to Enable Completions W/out Shell on Unix #48918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nagilson
Copy link
Member

I confirmed the proposal by Kalle, which resolves #48420 and confirmed that the shellMap that gets provided is a default list of shell names like "fish" or "zsh" that are stored in the Shell Env Var. They are all lowercase in the shell map.

I confirmed the proposal by Kalle, dotnet#48420 that the shellMap that gets provided is a default list of shell names like "fish" or "zsh" that are stored in the Shell Env Var. They are all lowercase in the shell map.
@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 18:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to enable static completions to work in scenarios where a shell has not been specified on Unix by leveraging a default mapping of lowercase shell names. Key changes include:

  • Adding a test (ShellDiscoveryTests.cs) to validate that the completions command works without an explicit shell.
  • Updating CompletionsCommand.cs to convert the shell name to lowercase before lookup in the shell map.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/dotnet.Tests/CompletionTests/ShellDiscoveryTests.cs Adds a new test ensuring completions work even without a specified shell.
src/System.CommandLine.StaticCompletions/CompletionsCommand.cs Normalizes the shell name to lowercase to match against the shell map.


public class ShellDiscoveryTests()
{
[Fact]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe parameterize this test with the shell names and set the SHELL env var before each run so we can easily test all of our shell experiences??

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet completions script produces confusing error when no shell supplied
2 participants