Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add a “Global verbosity option” example to README / documentation

Abierto
#2,746 5 comentarios 0 reacciones 0 asignados Ver en GitHub

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

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

Area-Documentation
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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/command-line-api

Todos los issues de dotnet/command-line-api

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.