feat: Make it possible to customize completions for specific command and flags
还没有人认领这个 Issue。
评估
调研方向
Start by reading the existing CompletionCommand behavior and how command and flag completions are currently produced; the issue names no files or tests. Done means a command such as foo install can provide its own version completions, with the behavior defined for its flags and verified against the expected tab-completion output.
由索引模型根据 Issue 内容生成。
描述
Description
I would like to have control over the completions that displayed for my command.
Let's say I have a command foo install <version>. This command also has 2 flags --dry-run and --help.
Current state
Only the flags are suggested:
$ foo install <TAB>
--help -- Print this usage information.
--dry-run -- Perform prechecks but do not install.
Expected state
$ foo install <TAB>
2.1.0
2.0.0
1.2.0
1.1.0
1.0.1
1.0.0
API idea:
/// Installs Flutter SDK
class InstallCommand extends CompletionCommand<int> {
@override
final name = 'install';
@override
final description = 'Installs foo version';
/// Returns the string that will be returned when tab completion
/// is called for this command.
///
/// This method should return fast for good user experience.
@override
Future<String> completions() {
print(MyFooVersionProvider.listAllVersions());
// The above line would print:
// 2.1.0
// 2.0.0
// 1.2.0
// 1.1.0
// 1.0.1
// 1.0.0
}
@override
Future<int> run() async { /** code **/ }
Additional Context
A similar CLI package in the Go ecosystem has this feature. See docs.
- 主要语言
- Dart
- 星标
- 54
- 派生
- 6
- 平均合并
- 6 天 17 小时
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
VeryGoodOpenSource/cli_completion 的其他 Issue
-
feature p3
难度 3/5 1-2 天 新手友好度 35/100
VeryGoodOpenSource/cli_completion#90 · 1 条评论 · 1 个 reaction ·
-
feature p2
VeryGoodOpenSource/cli_completion#55 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
-
feature p2
难度 4/5 3-5 天 新手友好度 35/100
VeryGoodOpenSource/cli_completion#47 · 2 条评论 · 2 个 reaction ·
查看 VeryGoodOpenSource/cli_completion 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
from.page-issue
难度 1/5 1 小时以内 新手友好度 85/100
-
triage
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
a2ui-project/a2ui#2763 ·