Return values from actions on Options?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comienza rastreando cómo se invocan las acciones de Option y cómo sus valores de retorno fluyen a través de la llamada de nivel superior Invoke. Compara ese comportamiento con las acciones de Command y con el manejo documentado de --help; después, determina cuál es el contrato previsto para las acciones de Option y qué comportamiento o documentación definiría el issue como resuelto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I'm trying to work out the "right" way to use this library, and a very simple use case that puzzles me is "detect that --help was invoked, so we can terminate the application after handling arguments", and it is not really clear to me how that should be done.
My first thought was that I should attach an Action to the Option, and have that action return non-zero, which would propagate out to the top-level Invoke call. Then I'd check the return value there, and if non-zero, terminate the application.
But if an Option's action returns non-zero the return value just seems to be discarded.
I also noted that none of the documentation seems to use actions on Option objects, and that while actions on Command objects can just be lambdas, the ones on Option have to be a class derived from CommandLineAction. It kind of feels like Option actions are a bit half-baked? Are they not supposed to be used?
So two questions:
- what is the point of setting actions on an
Optionobject? (And what is the point of being able to return an integer from those actions?) - what is the intended way to detect that --help was invoked so you can terminate the application?
- 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