Use stderr for prompts to better allow scripting (#14)
* Update invocations of inquirer.js prompts to output prompt to stderr. fixes #7 * Updates to use updated typings from @types/inquirer
This commit is contained in:
parent
a1b0dcf8fa
commit
c7160c0870
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bitwarden/cli",
|
"name": "@bitwarden/cli",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/inquirer": {
|
"@types/inquirer": {
|
||||||
"version": "0.0.41",
|
"version": "0.0.42",
|
||||||
"resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.41.tgz",
|
"resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.42.tgz",
|
||||||
"integrity": "sha512-kIWkK3FECGKt9OrURxRvi59gwMNiWTePXWOvaJn+xhplbEvu91hIDMfLe5PUu+cEEMmD6EFU4VFJJKKp5kzCtw==",
|
"integrity": "sha512-flMaNWU2g9NrtZ4bIV+7SEY2W7OdWNNhmJ0rE1lWVxGrkp3TfFGMcFCxRIBmGWigI8e6n+2HqLjizTTfgcpHLg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/rx": "4.1.1",
|
"@types/rx": "4.1.1",
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/commander": "^2.12.2",
|
"@types/commander": "^2.12.2",
|
||||||
"@types/form-data": "^2.2.1",
|
"@types/form-data": "^2.2.1",
|
||||||
"@types/inquirer": "^0.0.41",
|
"@types/inquirer": "^0.0.42",
|
||||||
"@types/lowdb": "^1.0.1",
|
"@types/lowdb": "^1.0.1",
|
||||||
"@types/lunr": "^2.1.5",
|
"@types/lunr": "^2.1.5",
|
||||||
"@types/node": "^10.0.8",
|
"@types/node": "^10.0.8",
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class ExportCommand {
|
||||||
|
|
||||||
async run(password: string, cmd: program.Command): Promise<Response> {
|
async run(password: string, cmd: program.Command): Promise<Response> {
|
||||||
if (password == null || password === '') {
|
if (password == null || password === '') {
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'password',
|
type: 'password',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
message: 'Master password:',
|
message: 'Master password:',
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class LoginCommand {
|
||||||
|
|
||||||
async run(email: string, password: string, cmd: program.Command) {
|
async run(email: string, password: string, cmd: program.Command) {
|
||||||
if (email == null || email === '') {
|
if (email == null || email === '') {
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'email',
|
name: 'email',
|
||||||
message: 'Email address:',
|
message: 'Email address:',
|
||||||
|
@ -37,7 +37,7 @@ export class LoginCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (password == null || password === '') {
|
if (password == null || password === '') {
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'password',
|
type: 'password',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
message: 'Master password:',
|
message: 'Master password:',
|
||||||
|
@ -89,7 +89,7 @@ export class LoginCommand {
|
||||||
const options = twoFactorProviders.map((p) => p.name);
|
const options = twoFactorProviders.map((p) => p.name);
|
||||||
options.push(new inquirer.Separator());
|
options.push(new inquirer.Separator());
|
||||||
options.push('Cancel');
|
options.push('Cancel');
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
name: 'method',
|
name: 'method',
|
||||||
message: 'Two-step login method:',
|
message: 'Two-step login method:',
|
||||||
|
@ -111,7 +111,7 @@ export class LoginCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (twoFactorToken == null) {
|
if (twoFactorToken == null) {
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'token',
|
name: 'token',
|
||||||
message: 'Two-step login code:',
|
message: 'Two-step login code:',
|
||||||
|
|
|
@ -16,7 +16,7 @@ export class UnlockCommand {
|
||||||
|
|
||||||
async run(password: string, cmd: program.Command) {
|
async run(password: string, cmd: program.Command) {
|
||||||
if (password == null || password === '') {
|
if (password == null || password === '') {
|
||||||
const answer = await inquirer.prompt<any>({
|
const answer: inquirer.Answers = await inquirer.createPromptModule({ output: process.stderr })({
|
||||||
type: 'password',
|
type: 'password',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
message: 'Master password:',
|
message: 'Master password:',
|
||||||
|
|
Loading…
Reference in New Issue