-
Notifications
You must be signed in to change notification settings - Fork 44
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
Changes from all commits
770009b
fb60913
16f6117
095d4cb
5692993
f0b7e84
69a721a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import type { CommandOptions } from '../lib/baseCommand'; | |
|
||
import chalk from 'chalk'; | ||
import config from 'config'; | ||
import prompts from 'prompts'; | ||
import isEmail from 'validator/lib/isEmail'; | ||
|
||
import Command, { CommandCategories } from '../lib/baseCommand'; | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
const promptResults = await promptTerminal([ | ||
const { email, password, project, token } = await promptTerminal([ | ||
{ | ||
type: 'text', | ||
name: 'email', | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
type: 'text', | ||
name: 'project', | ||
message: 'What project are you logging into?', | ||
initial: configStore.get('project'), | ||
|
@@ -74,10 +75,6 @@ export default class LoginCommand extends Command { | |
}, | ||
]); | ||
|
||
const { email, password, token } = promptResults; | ||
|
||
if (promptResults.project) project = promptResults.project; | ||
|
||
if (!project) { | ||
return Promise.reject(new Error('No project subdomain provided. Please use `--project`.')); | ||
} | ||
|
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.
😬