Replies: 6 comments
-
Apparently help command is built-in, and quite well hidden.
Can't imagine calling this code as user from outside of In theory you can also override default console output, like this:
and then display help at the end. (text will be without colors) Sounds bit complex solution as well. |
Beta Was this translation helpful? Give feedback.
-
The
I do wonder if this kind of explicit handling of command arguments could also be used for the |
Beta Was this translation helpful? Give feedback.
-
When this issue is triaged/is found to be valid - please assign it to myself and I'm happy to fix. |
Beta Was this translation helpful? Give feedback.
-
I would prefer that no need to assume order of arguments - whether help comes first or not. Previously I have help parameter handling as hardcoded, and it was parsed like this:
But this also implies that help command is the same as Could this be coded somehow like this:
? |
Beta Was this translation helpful? Give feedback.
-
Would you propose to also refactor the code snippet above that handles the |
Beta Was this translation helpful? Give feedback.
-
Generally API's and functionalities they provide:
For API1 - consistency, and simplity to use. Maybe it would make sense to also refactor API2 to have parse and print as a separate operations, but I think returning two return parameters would be beneficial already. |
Beta Was this translation helpful? Give feedback.
-
If you code simple application
Spectre.Console
- then you're interested not only on parsing command line arguments, but also you're interested in figuring out whether--help
was used as command line argument.Using .net reflection it's possible:
https://github.com/tapika/swupd/blob/master/cakebuild/CommandLineArgs.cs#L248
but uses bit ugly syntax for that purpose.
Is there a simpler solution to this ?
Beta Was this translation helpful? Give feedback.
All reactions