File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ const models = require("../lib/models/");
88const readline = require ( "readline-sync" ) ;
99const minimist = require ( "minimist" ) ;
1010
11- var usage = `
11+ function showUsage ( tips ) {
12+ console . log ( `${ tips }
1213
1314Command-line utility to create users for email-signin.
1415
@@ -17,7 +18,9 @@ Usage: bin/manage_users [--pass password] (--add | --del) user-email
1718 --add Add user with the specified user-email
1819 --del Delete user with specified user-email
1920 --pass Use password from cmdline rather than prompting
20- `
21+ ` ) ;
22+ process . exit ( 1 ) ;
23+ }
2124
2225// Using an async function to be able to use await inside
2326async function createUser ( argv ) {
@@ -74,16 +77,12 @@ var action = opts[0];
7477
7578// Check for options missing
7679if ( 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 ' ) } !` ) ;
8081}
8182
8283// Check if both are specified
8384if ( 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!` ) ;
8786}
8887
8988// Call respective processing functions
You can’t perform that action at this time.
0 commit comments