`dotnet-suggest list` truncates dotted global tool names

オープン 初心者向け
#2,887 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
cli

調査の方向性

FileEnumerator.cs の FileEnumerator.EnumerateFilesWithoutExtension と SuggestionDispatcher.cs の SuggestionDispatcher.ShellPrefixesToMatch から始め、それぞれが Linux の実行可能ファイル名をどのように扱うかを追跡し、関連するテストを確認してください。関連するテストを実行した後、dotnet-suggest list がドットを含むツール名を完全な形で保持し、PowerShell shim がそれらの補完機能を登録できることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C#
スター
3.7k
フォーク
439
平均マージ
4日 8時間
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/command-line-api のほかの issue

dotnet/command-line-api の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。