`dotnet-suggest list` truncates dotted global tool names

Abierto Apto para principiantes
#2,887 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
cli

Línea de trabajo

Empieza con FileEnumerator.EnumerateFilesWithoutExtension en FileEnumerator.cs y SuggestionDispatcher.ShellPrefixesToMatch en SuggestionDispatcher.cs; sigue cómo gestiona cada uno los nombres de ejecutables de Linux y comprueba las pruebas relacionadas. Ejecuta las pruebas pertinentes y, después, verifica que dotnet-suggest list conserva los nombres completos de las herramientas con puntos para que el shim de PowerShell pueda registrar completadores para ellas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

The tool names below are anonymized. They retain the same number of dotted segments as the original names.

Environment
  • OS: Linux
  • dotnet-suggest: 3.0.0
  • Shell: PowerShell
Steps to reproduce
  1. Install a .NET global tool with a dotted command name, for example Example.Tools.StatusMonitor.Console.
  2. Verify that dotnet tool list -g shows the full name in the Commands column.
  3. Run dotnet-suggest list.
Expected behavior

The list contains Example.Tools.StatusMonitor.Console, so the PowerShell shim can register a completer for the full command name.

Actual behavior

The list shows Example.Tools. A second tool, SampleUi.Automation.TestClient, appears as SampleUi.

Tab completion for the full name fails with the standard PowerShell shim. Passing the full executable path directly returns the expected options:

$name = 'Example.Tools.StatusMonitor.Console'
$exe = (Get-Command $name -CommandType Application).Source
$line = "$name --"
dotnet-suggest get -e $exe --position $line.Length -- $line

Explicitly registering the full name with Register-ArgumentCompleter -Native restores tab completion.

Likely cause

In v3.0.0, global-tool discovery calls Path.GetFileNameWithoutExtension in FileEnumerator.EnumerateFilesWithoutExtension, removing .Console from the Linux executable name. SuggestionDispatcher.ShellPrefixesToMatch calls the same method again when producing list output, removing .StatusMonitor. The PowerShell shim uses the resulting name to register the completer.

Background

We use the same name for a C# project, its assembly, and its installed command. This makes it easier to trace a command in a deployment script or log back to the project that builds it. Our project names follow the dotted naming convention we use across our C# codebase, so preserving the dots in the command name is important to us.

Lenguaje dominante
C#
Estrellas
3.7k
Forks
439
Merge medio
4 d 8 h
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/command-line-api

Todos los issues de dotnet/command-line-api

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.