Skip to content

Commit

Permalink
Use stderr for prompts to better allow scripting (#14)
Browse files Browse the repository at this point in the history
* Update invocations of inquirer.js prompts to output prompt to stderr.

fixes #7

* Updates to use updated typings from @types/inquirer
  • Loading branch information
kwkelly authored and kspearrin committed Jun 19, 2018
1 parent a1b0dcf commit c7160c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@types/commander": "^2.12.2",
"@types/form-data": "^2.2.1",
"@types/inquirer": "^0.0.41",
"@types/inquirer": "^0.0.42",
"@types/lowdb": "^1.0.1",
"@types/lunr": "^2.1.5",
"@types/node": "^10.0.8",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/export.command.ts
Expand Up @@ -19,7 +19,7 @@ export class ExportCommand {

async run(password: string, cmd: program.Command): Promise<Response> {
if (password == null || password === '') {
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'password',
name: 'password',
message: 'Master password:',
Expand Down
8 changes: 4 additions & 4 deletions src/commands/login.command.ts
Expand Up @@ -22,7 +22,7 @@ export class LoginCommand {

async run(email: string, password: string, cmd: program.Command) {
if (email == null || email === '') {
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'input',
name: 'email',
message: 'Email address:',
Expand All @@ -37,7 +37,7 @@ export class LoginCommand {
}

if (password == null || password === '') {
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'password',
name: 'password',
message: 'Master password:',
Expand Down Expand Up @@ -89,7 +89,7 @@ export class LoginCommand {
const options = twoFactorProviders.map((p) => p.name);
options.push(new inquirer.Separator());
options.push('Cancel');
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'list',
name: 'method',
message: 'Two-step login method:',
Expand All @@ -111,7 +111,7 @@ export class LoginCommand {
}

if (twoFactorToken == null) {
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'input',
name: 'token',
message: 'Two-step login code:',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/unlock.command.ts
Expand Up @@ -16,7 +16,7 @@ export class UnlockCommand {

async run(password: string, cmd: program.Command) {
if (password == null || password === '') {
const answer = await inquirer.prompt<any>({
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
type: 'password',
name: 'password',
message: 'Master password:',
Expand Down

0 comments on commit c7160c0

Please sign in to comment.