Add a “Global verbosity option” example to README / documentation
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 25/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- csharp
- 领域
- cli, documentation
调研方向
首先查看 README 和 samples 文件夹,了解现有的 System.CommandLine 示例以及 root.AddGlobalOption 的使用方式。添加一个清晰的全局 -v/--verbosity 选项示例,展示 handler 如何读取该值或应用默认值,并确认该示例作为独立的文档示例是易于理解的。
由索引模型根据 Issue 内容生成。
描述
Description
Type of issue
Feature request / documentation sample
Description
Many CLI tools follow a pattern where a global --verbosity (short -v) option controls log or output verbosity across all subcommands.
Currently, README and docs do not have a clear example showing how to implement this using System.CommandLine.
Suggested improvement
Add a sample to README or samples folder demonstrating:
var verbosity = new Option<string>(new [] { "-v", "--verbosity" }, "Set verbosity");
root.AddGlobalOption(verbosity);
// ... handler that reads verbosity value or sets default if no value given
### Reproduction Steps
### Type of issue
Feature request / documentation sample
### Description
Many CLI tools follow a pattern where a global --verbosity (short -v) option controls log or output verbosity across all subcommands.
Currently, README and docs do not have a clear example showing how to implement this using System.CommandLine.
### Suggested improvement
Add a sample to README or samples folder demonstrating:
```csharp
var verbosity = new Option<string>(new [] { "-v", "--verbosity" }, "Set verbosity");
root.AddGlobalOption(verbosity);
// ... handler that reads verbosity value or sets default if no value given
### Expected behavior
The SDK should locate global.json starting from:
The solution directory (if a .sln exists),
Else the project directory (if a .csproj exists),
Else the current working directory.
Then it should search parent folders upward and use the first global.json found to determine the SDK version.
### Actual behavior
The SDK currently starts searching for global.json from the current working directory only,
without first checking for a solution or project directory.
As a result, running dotnet build or dotnet restore from subfolders may ignore the intended global.json at the solution level.
This leads to unexpected SDK versions being used in multi-project setups.
### Regression?
The SDK currently starts searching for global.json from the current working directory only,
without first checking for a solution or project directory.
As a result, running dotnet build or dotnet restore from subfolders may ignore the intended global.json at the solution level.
This leads to unexpected SDK versions being used in multi-project setups.
### Known Workarounds
The SDK currently starts searching for global.json from the current working directory only,
without first checking for a solution or project directory.
As a result, running dotnet build or dotnet restore from subfolders may ignore the intended global.json at the solution level.
This leads to unexpected SDK versions being used in multi-project setups.
### Configuration
The SDK currently starts searching for global.json from the current working directory only,
without first checking for a solution or project directory.
As a result, running dotnet build or dotnet restore from subfolders may ignore the intended global.json at the solution level.
This leads to unexpected SDK versions being used in multi-project setups.
### Other information
The SDK currently starts searching for global.json from the current working directory only,
without first checking for a solution or project directory.
As a result, running dotnet build or dotnet restore from subfolders may ignore the intended global.json at the solution level.
This leads to unexpected SDK versions being used in multi-project setups.
- 主要语言
- C#
- 星标
- 3.7k
- 派生
- 434
- 平均合并
- 6 小时 27 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/command-line-api 的其他 Issue
-
German localization is incomplete可能已有人在做 @b-v-d-e-v 于 19 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
dotnet/command-line-api#2852 ·
维护者通常 1 天内回复
-
Incomplete French (fr) translation: RequiredOptionWasNotProvided not translated可能已有人在做 @JPBlanc 于 116 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
dotnet/command-line-api#2822 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
dotnet/command-line-api#2792 · 2 条评论 · 16 个 reaction ·
维护者通常 1 天内回复
-
`Argument.Arity` modify internal state on first get access.可能已有人在做 @zjdangge 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
dotnet/command-line-api#2704 ·
维护者通常 1 天内回复
-
GetCompletions should check exit code of invoked application可能已有人在做 @baradgur 于 1288 天前认领。 未关闭Area-Completions bug help wanted
难度 2/5 1-3 小时 新手友好度 72/100
dotnet/command-line-api#2137 · 1 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
查看 dotnet/command-line-api 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 65/100
KnifeLemon/Filee#294 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
gavin-wolfe/wolfden#104 ·
维护者通常 1 天内回复
-
[BUG] Still libmicrohttpd dependency is not removed properly from External-Dependency-Info.txt file未关闭type/bug
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
area:framework
难度 1/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[辞書] かんそうりつ->乾燥率未关闭辞書
难度 1/5 1 小时以内 新手友好度 62/100
维护者通常 1 天内回复