Add a “Global verbosity option” example to README / documentation
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Documentación
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- cli, documentation
Línea de trabajo
Comienza revisando README y la carpeta samples en busca de ejemplos existentes de System.CommandLine y del uso de root.AddGlobalOption. Añade un ejemplo claro de una opción global -v/--verbosity que muestre cómo el handler lee el valor o aplica un valor predeterminado, y confirma que el ejemplo se entiende como una muestra de documentación independiente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 3.7k
- Forks
- 434
- Merge medio
- 4 h 46 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/command-line-api
-
German localization is incompletePosiblemente ocupada @b-v-d-e-v la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
dotnet/command-line-api#2852 ·
-
Incomplete French (fr) translation: RequiredOptionWasNotProvided not translatedPosiblemente ocupada @JPBlanc la tomó hace 106 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
dotnet/command-line-api#2822 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
dotnet/command-line-api#2792 · 2 comentarios · 16 reacciones ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
dotnet/command-line-api#2704 ·
-
GetCompletions should check exit code of invoked applicationPosiblemente ocupada @baradgur la tomó hace 1277 días. AbiertoArea-Completions bug help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dotnet/command-line-api#2137 · 1 comentario · 3 reacciones ·
Todos los issues de dotnet/command-line-api
Issues similares
-
[Tool] DirectBenchAbiertohas-image has-readme needs-attention new-tool repo-verified
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
shanselman/TinyToolTown#844 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
[i18n] 安装实例完成后的成功提示未正确本地化Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
PCL-Community/PCL-CE#3658 ·
Los mantenedores suelen responder en 1 día
-
Deploy & Patch-issues opprettes ikke: create-pnd-issues.yml har feilet hver uke siden 2025-09-08Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Altinn/altinn-auth#4359 ·
Los mantenedores suelen responder en 1 día
-
アプリ: チャット 優先: 中 提案
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
yksr-melt/Meltype#243 · 1 comentario ·
Los mantenedores suelen responder en 1 día