spectreconsole / spectre.console

A .NET library that makes it easier to create beautiful console applications.
https://spectreconsole.net
MIT License
9.17k stars 472 forks source link

Missing examples in documentation for text prompt #1615

Closed OronDF343 closed 4 days ago

OronDF343 commented 3 weeks ago

Link

There are no code examples on this page.

FrankRay78 commented 3 weeks ago

@OronDF343 Has the lack of examples stopped you from using the text prompt? If not, how did you figure out the usage? (I'm trying to triage the priority of this issue)

Mehybinator commented 2 weeks ago

@FrankRay78 speaking of my personal experience on the issue, the lack of examples on the main website led me to the github to try and figure out how to use it, my eyes glanced at the examples folder and so i opend it and saw the prompts example, one thing i figured out was that there are some options, one is that i can use AnsiConsole.Ask to ask a question in the terminal, but also the same thing could be implemented by just puting a new TextPrompt in a Prompt, which beged the question whether its even needed to use the Ask because you might need to customize the prompt for example to allow empty strings and defaults which are not included in Ask, but also imo there arent a lot of variations of the uses of each class, which is not a problem but i would've loved to see anything but Text being used in panels and layouts, another issue i found was that there is no spot on the main website for Altscreen, i found out about it in the examples folder too, so thats my experience. i am a begginer to C# and im trying to implement an application i've made in C# which was originally written in go, and the reason is basically this project, so i would love to send my thanks to the team behind Spectre.Console, stay safe.

OronDF343 commented 2 weeks ago

As a first time user, I figured it out by going to the next documentation page down and guessing based on the API shape. So it's not a problem once you know how to use the library.

On August 24, 2024 6:05:48 PM GMT+03:00, Frank Ray @.***> wrote:

@OronDF343 Has the lack of examples stopped you from using the text prompt? If not, how did you figure out the usage? (I'm trying to triage the priority of this issue)

-- Reply to this email directly or view it on GitHub: https://github.com/spectreconsole/spectre.console/issues/1615#issuecomment-2308424368 You are receiving this because you were mentioned.

Message ID: @.***> -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

FrankRay78 commented 2 weeks ago

Thanks @OronDF343, @Mehybinator, that's really helpful. I've long suspected the examples solution would benefit from more prominence. I know it's mentioned on the main GitHub readme, but I think we only directly link to examples from two pages in the main spectre website, and these are DI and the help writer, not any widget pages. I'm going to have a little think how this might be improved for new devs using the library.

davide-pi commented 5 days ago

Hi, @FrankRay78 I have a branch with the example added to the documentation file. I can open a PR, but I'm not sure about the last example, the Optional one. I've searched a bit without finding anything, so I've implemented the example using a TextPrompt with the AllowEmpty option. Is this the correct way?

Thanks

FrankRay78 commented 4 days ago

Cool. Why not open a PR for your branch @davide-pi and I'll take a look at the changes?

davide-pi commented 4 days ago

Thanks @FrankRay78, here you can find the PR. I've also leaved a comment for you in the example I've mentioned above, about the Optional TextPrompt.

davide-pi commented 4 days ago

Hi, @FrankRay78 I think this could be closed. @OronDF343 Please check the doc and let us know if it meets what you requested 🙇

patriksvensson commented 4 days ago

Resolved in #1636