Skip to content

Commit 41a784c

Browse files
committed
Clean-up CLI
1 parent 018dcd7 commit 41a784c

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

bin/cli

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ var commands = require( './commands.json' );
1515

1616
// FUNCTIONS //
1717

18+
/**
19+
* Performs initialization tasks.
20+
*
21+
* @private
22+
* @example
23+
* init();
24+
*/
25+
function init() {
26+
var opts;
27+
28+
// Check if newer versions exist for this package:
29+
opts = {
30+
'pkg': pkg
31+
};
32+
notifier( opts ).notify();
33+
34+
// Set the process title to allow the process to be more easily identified:
35+
process.title = pkg.name;
36+
process.stdout.on( 'error', process.exit );
37+
} // end FUNCTION init()
38+
1839
/**
1940
* Prints usage information.
2041
*
@@ -69,29 +90,18 @@ var cmd;
6990
var i;
7091

7192

72-
// INIT //
73-
74-
process.title = pkg.name;
75-
process.stdout.on( 'error', process.exit );
76-
77-
78-
// PACKAGE UPDATES //
79-
80-
notifier( { 'pkg': pkg } ).notify();
81-
93+
// MAIN //
8294

83-
// ARGUMENTS //
95+
init();
8496

97+
// Parse command-line arguments:
8598
args1 = parseArgs( process.argv.slice( 2 ), opts );
8699

87100
if ( args1.version ) {
88101
return version();
89102
}
90103
cmd = args1._[ 0 ];
91104

92-
93-
// MAIN //
94-
95105
opts = {
96106
'cwd': process.cwd(),
97107
'env': process.env,

0 commit comments

Comments
 (0)