commandlineparser / commandlineparser/commandline

Interactive mode

未关闭
#653 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
feature request
主要语言
C#
星标
4.8k
派生
478
PR 合并指标
30 天内没有已合并 PR

描述

I would like to have a new parameter for Option: bool Interactive. When this is set to true, a delegate function will be called (which you need to pass in to the Parser somehow). This must happen BEFORE the check for required parameters is done. This will allow the developer to ask for the values interactively.
The return type of the delegate is object. When the delegate returns a non-null value, the value is assigned to the parameter (if the parameter is of a primitive type, the object is first cast to a nullable and the Value is used). When the delegate returns null, nothing happens and the Parser continues normally (possibly failing when the parameter was set to required).
The construction with the delegate ensures encapsulation (not an extra dependency on the console), and also gives the developer additional flexibility. But it's also fine if this is implemented as a simple method inside the parser, interacting with the console from CommandlineParser directly.

Either way, I think this would be a really helpful enhancement for many users of CommandLineParser.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。