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 摘要。