-
Notifications
You must be signed in to change notification settings - Fork 43
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
chore(prompt): various enhancements and refactors #576
Conversation
I was looking through the docs and saw that onState was injected into every question in the question array and would run on every keystroke, and saw that onCancel existed and would look a lot cleaner in our prompt wrapper.
I'm not sure this is needed? I'm not able to get rid of the cursor anymore 🤔
@@ -44,9 +45,9 @@ export default class LoginCommand extends Command { | |||
async run(opts: CommandOptions<Options>) { | |||
super.run(opts); | |||
|
|||
let { project } = opts; | |||
prompts.override(opts); |
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.
I got irrationally excited about this one lol
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.
Should we use this in every command with prompts that can be fed arguments?
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.
yeahhh I read about override and login was the first thing I thought of... I don't want to look at the versions
commands for a long time lmao but I looked into doing this for the prepareOas
handler and we have enough complexity to our spec searching that I can't think of a useful refactor approach
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'd rather remove the versions commands before even thinking about doing anything else to them
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.
can't replicate the missing cursor problem with this but that auth refactor is 💯
@@ -103,5 +103,21 @@ describe('rdme login', () => { | |||
mock.done(); | |||
}); | |||
|
|||
it.todo('should error if trying to access a project that is not yours'); |
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.
😬
@@ -44,9 +45,9 @@ export default class LoginCommand extends Command { | |||
async run(opts: CommandOptions<Options>) { | |||
super.run(opts); | |||
|
|||
let { project } = opts; | |||
prompts.override(opts); |
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.
Should we use this in every command with prompts that can be fed arguments?
@@ -62,7 +63,7 @@ export default class LoginCommand extends Command { | |||
message: 'What is your password?', | |||
}, | |||
{ | |||
type: opts.project ? null : 'text', |
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.
prompts
rules, good lord.
🧰 Changes
login
command to use overrides and added a few testsonState
usage to useonCancel
(see 16f6117 for more reasoning)enableTerminalCursor
function. Not sure if it was working before but I've tried a bunch of things and can't get my cursor to disappear. I'm cool with keeping it in there just to be safe too, let me know what you think 🤷🏽key
argument via theargs
array, rather than having a flag that we have to manually enable🧬 QA & Testing
Tests appear to pass, but it might be good to check out this branch, run the build, and try messing around.
Footnotes
You can test this by prefixing any command with a CI env variable. I've been running
GITLAB_CI=true bin/rdme login
↩