-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(SDK-284) Add guidance for users during new module interview #103
Conversation
a3c6a8b
to
4a44097
Compare
|
||
interview = PDK::CLI::Util::Interview.new(prompt) | ||
|
||
questions.reject! { |q| q[:name] == 'license' } if opts.key?(:license) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea!
Love this is general, it does have some slightly sad times on Windows when it repositions the cursor, which is a similar issue to tty-spinner which hopefully will be resolved by
In the meantime perhaps we can add a Windows fallback UI? (Or we can just prioritize getting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean Windows output
lib/pdk/generators/module.rb
Outdated
help: _('This will be used when uploading your module to the Forge. You can opt out of this at any time.'), | ||
required: true, | ||
validate_pattern: %r{\A[a-z0-9]+\Z}, | ||
validate_message: _('Forge usernames can only contain letters and numbers'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowercase letters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Technically the Forge will accept uppercase but I think we want to strongly discourage that, we may even coerce new usernames to all lowercase.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just stole that pattern from PDK::Module::Metadata
's name validation :)
I've spent a bit of time today to explore our options. Turns out that full VT100 emulation is supported in the windows console. Starting from Windows 10 TH2 :-/ See https://stackoverflow.com/a/44482740 for details. As a fallback, @scotje (as well as the SO answer linked above) suggest ansicon, which works fine in my testing. I'll ticket ansicon integration separately. I expect that packaging to be straightforward, so we can merge this in expectation that we'll have ansicon available RSN? |
1076bb1
to
58ce32a
Compare
Yes, the very latest Windows 10 has control sequence support but you do have to opt into it still. :( |
DavidS@6ec007e has a prototype for supporting Windows' VT100 support. Since this support is so new, we can't depend on it, and need to investigate/implement alternative routes, like ansicon, see SDK-293. @scotje as this is primarily an aesthetic problem, can we merge this, and revisit a local fallback here vs. using ansicon, in the next few days when we understand better the costs of ansicon? |
@DavidS (shrug) We've gone out of our way to provide a fallback for the spinner stuff but I understand the prompt is more complicated. I basically didn't want to assume we would get But if we want to just commit to control sequence support on Windows sooner rather than later, I'm fine skipping any fallback for now in favor of |
I need to do the sprint demo tonight, and would love to ship a new code drop before my PTO next week, so I'll hack on this, and the ansicon stuff today. |
Refactors the module metadata interview to use TTY::Prompt. This provides a much nicer user experience when an invalid response is given in that it will blank and reprint the question on the same line rather than reprinting the question on a new line.
Additionally, the questions are now numbered (automatically) and can be specified with some help text to provide guidance to the users. The interview definition has also been separated from the metadata update process in order to make it easier to update the questions in the future.