Add a “Global verbosity option” example to README / documentation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- cli, documentation
Direzione di ricerca
Inizia esaminando README e la cartella samples alla ricerca di esempi esistenti di System.CommandLine e dell’uso di root.AddGlobalOption. Aggiungi un esempio chiaro di un’opzione globale -v/--verbosity che mostri come l’handler legge il valore o applica un valore predefinito, e conferma che l’esempio sia comprensibile come esempio di documentazione autonomo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 3.7k
- Fork
- 434
- Merge medio
- 6h 27m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnet/command-line-api
-
German localization is incompleteForse già presa @b-v-d-e-v l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dotnet/command-line-api#2852 ·
-
Incomplete French (fr) translation: RequiredOptionWasNotProvided not translatedForse già presa @JPBlanc l’ha presa 109 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dotnet/command-line-api#2822 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
dotnet/command-line-api#2792 · 2 commenti · 16 reazioni ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
dotnet/command-line-api#2704 ·
-
GetCompletions should check exit code of invoked applicationForse già presa @baradgur l’ha presa 1280 giorni fa. ApertaArea-Completions bug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dotnet/command-line-api#2137 · 1 commento · 3 reazioni ·
Tutte le issue di dotnet/command-line-api
Issue simili
-
bug next version
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Rem0o/FanControl.Releases#4220 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nkdAgility/azure-devops-migration-tools#3217 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
skoruba/Duende.IdentityServer.Admin#335 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
question
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100