File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ const models = require("../lib/models/");
8
8
const readline = require ( "readline-sync" ) ;
9
9
const minimist = require ( "minimist" ) ;
10
10
11
- var usage = `
11
+ function showUsage ( tips ) {
12
+ console . log ( `${ tips }
12
13
13
14
Command-line utility to create users for email-signin.
14
15
@@ -17,7 +18,9 @@ Usage: bin/manage_users [--pass password] (--add | --del) user-email
17
18
--add Add user with the specified user-email
18
19
--del Delete user with specified user-email
19
20
--pass Use password from cmdline rather than prompting
20
- `
21
+ ` ) ;
22
+ process . exit ( 1 ) ;
23
+ }
21
24
22
25
// Using an async function to be able to use await inside
23
26
async function createUser ( argv ) {
@@ -74,16 +77,12 @@ var action = opts[0];
74
77
75
78
// Check for options missing
76
79
if ( opts . length === 0 ) {
77
- console . log ( `You did not specify either ${ keys . map ( ( key ) => `--${ key } ` ) . join ( ' or ' ) } !` ) ;
78
- console . log ( usage ) ;
79
- process . exit ( 1 ) ;
80
+ showUsage ( `You did not specify either ${ keys . map ( ( key ) => `--${ key } ` ) . join ( ' or ' ) } !` ) ;
80
81
}
81
82
82
83
// Check if both are specified
83
84
if ( opts . length > 1 ) {
84
- console . log ( `You cannot ${ action . join ( ' and ' ) } at the same time!` ) ;
85
- console . log ( usage ) ;
86
- process . exit ( 1 ) ;
85
+ showUsage ( `You cannot ${ action . join ( ' and ' ) } at the same time!` ) ;
87
86
}
88
87
89
88
// Call respective processing functions
You can’t perform that action at this time.
0 commit comments