RFC for ArgumentCompleter base class
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- powershell
- 領域
- cli
研究方向
先閱讀所參照的 issue #269,以及本 RFC 中提出的 ArgumentCompleter 範例。釐清所要求的通用行為——引用引數、比對 WordToComplete,以及排序結果——並定義基底類別 API 與補全語意。當 RFC 為自訂 ArgumentCompleter 確立了設計,並具備一致的補全行為時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
#269
Provide a base class, ArgumentCompleter, to simplify writing custom argument completers
Some common tasks need to be done almost every time a completer is written.
Things like quoting arguments if they contain spaces, matching against WordToComplete, and ensuring that the results are sorted is another such task.
Motivation
As a Developer,
I can use the base class when writing custom argument completers,
so that results are achieved faster, with high quality, and
so that users get a consistent completion experience.
User Experience
using namespace System.Management.Automation;
public class GetCommitCompleter : ArgumentCompleter
{
// override simplified completer
protected override CompletionResultSortKind AddCompletionsFor(string commandName, string parameterName, IDictionary fakeBoundParameters)
{
switch (parameterName)
{
case nameof(GitRebaseCommand.CommitHash):
CompleteGitCommitHash();
break;
}
return CompletionResultSortKind.Sorted;
}
private void CompleteGitCommitHash()
{
var user = GetFakeBoundParameter<string>("User");
foreach(var commit in GitExe.Log())
{
if (user is { } u && commit.User != u){
continue;
}
// use a function to complete if the text or tooltip matches WordToComplete
CompleteMatching(text: commit.Hash, tooltip: $"{commit.User}\r\n{commit.Description}}": CompletionMatch.AnyContainsWithWordToComplete);
}
}
}
- 主要語言
- PowerShell
- 星號
- 468
- 分支
- 143
- 平均合併
- 9 小時 5 分鐘
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/PowerShell-RFC 的其他 Issue
-
Update template Plan to implement to allow additional option可能已有人在做 @kilasuit 於 301 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
PowerShell/PowerShell-RFC#404 · 1 則留言 ·
-
PowerShell Community Dashboard: No Data After October 2024可能重新可做 @theJasonHelmick 於 233 天前認領,目前沒有進行中的 PR。 未關閉
PowerShell/PowerShell-RFC#407 · 1 則留言 · 已指派 1 人 ·
-
難度 4/5 3-5 天 新手友好度 35/100
PowerShell/PowerShell-RFC#396 ·
-
難度 5/5 一週以上 新手友好度 20/100
PowerShell/PowerShell-RFC#334 · 2 個 reaction ·
-
難度 5/5 一週以上 新手友好度 35/100
PowerShell/PowerShell-RFC#327 · 28 則留言 · 31 個 reaction ·
查看 PowerShell/PowerShell-RFC 的全部 Issue
相似的 Issue
-
[Misdetection] `text/tab-separated-values` file misdetected as `text/tsv`可能已有人在做 @bact 今天認領。 未關閉misdetection needs triage
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
JuliusBrussee/caveman#1189 ·
維護者通常 1 天內回覆
-
omarchy-menu-keybindings lua bind scan spins at 100% CPU when user config iterates a mocked hl API未關閉
難度 2/5 1-3 小時 新手友好度 82/100
omacom/omarchy#14302 · 1 則留言 ·
維護者通常 1 天內回覆
-
jobs restart --verify: hotlane restart timeout (10s) shorter than its shutdown (~30s) → false exit 1未關閉
難度 2/5 1-3 小時 新手友好度 85/100
EtanHey/brainlayer#1072 ·
維護者通常 1 天內回覆