Skip to content

Commit ac816a8

Browse files
committed
Update CLIs
1 parent 44c8c84 commit ac816a8

File tree

5 files changed

+85
-75
lines changed
  • lib/node_modules/@stdlib/random/streams
    • cauchy/bin
    • chi/bin
    • chisquare/bin
    • cosine/bin
    • discrete-uniform/bin

5 files changed

+85
-75
lines changed

lib/node_modules/@stdlib/random/streams/cauchy/bin/cli

+17-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ var randomStream = require( './../lib' );
3939

4040
// FUNCTIONS //
4141

42-
/**
43-
* Callback invoked upon encountering an error.
44-
*
45-
* @private
46-
* @param {Error} error - error
47-
* @param {integer} [code] - exit code
48-
*/
49-
function onError( error, code ) {
50-
process.exitCode = code || 1;
51-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
52-
}
53-
5442
/**
5543
* Callback invoked once a source stream ends.
5644
*
@@ -118,6 +106,12 @@ function main() {
118106
})
119107
});
120108

109+
// Get any provided command-line options:
110+
flags = cli.flags();
111+
if ( flags.help || flags.version ) {
112+
return;
113+
}
114+
121115
// Get the current working directory:
122116
dir = cwd();
123117

@@ -130,9 +124,6 @@ function main() {
130124
args[ 0 ] = parseFloat( args[ 0 ] );
131125
args[ 1 ] = parseFloat( args[ 1 ] );
132126

133-
// Get any provided command-line flags:
134-
flags = cli.flags();
135-
136127
opts = {};
137128
if ( flags.iter ) {
138129
opts.iter = parseInt( flags.iter, 10 );
@@ -186,6 +177,17 @@ function main() {
186177
onError( err, code || 1 );
187178
}
188179
}
180+
181+
/**
182+
* Callback invoked upon encountering an error.
183+
*
184+
* @private
185+
* @param {Error} error - error
186+
* @param {integer} [code] - exit code
187+
*/
188+
function onError( error, code ) {
189+
cli.error( error, code || 1 );
190+
}
189191
}
190192

191193
main();

lib/node_modules/@stdlib/random/streams/chi/bin/cli

+17-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ var randomStream = require( './../lib' );
3939

4040
// FUNCTIONS //
4141

42-
/**
43-
* Callback invoked upon encountering an error.
44-
*
45-
* @private
46-
* @param {Error} error - error
47-
* @param {integer} [code] - exit code
48-
*/
49-
function onError( error, code ) {
50-
process.exitCode = code || 1;
51-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
52-
}
53-
5442
/**
5543
* Callback invoked once a source stream ends.
5644
*
@@ -118,6 +106,12 @@ function main() {
118106
})
119107
});
120108

109+
// Get any provided command-line options:
110+
flags = cli.flags();
111+
if ( flags.help || flags.version ) {
112+
return;
113+
}
114+
121115
// Get the current working directory:
122116
dir = cwd();
123117

@@ -129,9 +123,6 @@ function main() {
129123
}
130124
args[ 0 ] = parseFloat( args[ 0 ] );
131125

132-
// Get any provided command-line flags:
133-
flags = cli.flags();
134-
135126
opts = {};
136127
if ( flags.iter ) {
137128
opts.iter = parseInt( flags.iter, 10 );
@@ -185,6 +176,17 @@ function main() {
185176
onError( err, code || 1 );
186177
}
187178
}
179+
180+
/**
181+
* Callback invoked upon encountering an error.
182+
*
183+
* @private
184+
* @param {Error} error - error
185+
* @param {integer} [code] - exit code
186+
*/
187+
function onError( error, code ) {
188+
cli.error( error, code || 1 );
189+
}
188190
}
189191

190192
main();

lib/node_modules/@stdlib/random/streams/chisquare/bin/cli

+17-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ var randomStream = require( './../lib' );
3939

4040
// FUNCTIONS //
4141

42-
/**
43-
* Callback invoked upon encountering an error.
44-
*
45-
* @private
46-
* @param {Error} error - error
47-
* @param {integer} [code] - exit code
48-
*/
49-
function onError( error, code ) {
50-
process.exitCode = code || 1;
51-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
52-
}
53-
5442
/**
5543
* Callback invoked once a source stream ends.
5644
*
@@ -118,6 +106,12 @@ function main() {
118106
})
119107
});
120108

109+
// Get any provided command-line options:
110+
flags = cli.flags();
111+
if ( flags.help || flags.version ) {
112+
return;
113+
}
114+
121115
// Get the current working directory:
122116
dir = cwd();
123117

@@ -129,9 +123,6 @@ function main() {
129123
}
130124
args[ 0 ] = parseFloat( args[ 0 ] );
131125

132-
// Get any provided command-line flags:
133-
flags = cli.flags();
134-
135126
opts = {};
136127
if ( flags.iter ) {
137128
opts.iter = parseInt( flags.iter, 10 );
@@ -185,6 +176,17 @@ function main() {
185176
onError( err, code || 1 );
186177
}
187178
}
179+
180+
/**
181+
* Callback invoked upon encountering an error.
182+
*
183+
* @private
184+
* @param {Error} error - error
185+
* @param {integer} [code] - exit code
186+
*/
187+
function onError( error, code ) {
188+
cli.error( error, code || 1 );
189+
}
188190
}
189191

190192
main();

lib/node_modules/@stdlib/random/streams/cosine/bin/cli

+17-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ var randomStream = require( './../lib' );
3939

4040
// FUNCTIONS //
4141

42-
/**
43-
* Callback invoked upon encountering an error.
44-
*
45-
* @private
46-
* @param {Error} error - error
47-
* @param {integer} [code] - exit code
48-
*/
49-
function onError( error, code ) {
50-
process.exitCode = code || 1;
51-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
52-
}
53-
5442
/**
5543
* Callback invoked once a source stream ends.
5644
*
@@ -118,6 +106,12 @@ function main() {
118106
})
119107
});
120108

109+
// Get any provided command-line options:
110+
flags = cli.flags();
111+
if ( flags.help || flags.version ) {
112+
return;
113+
}
114+
121115
// Get the current working directory:
122116
dir = cwd();
123117

@@ -130,9 +124,6 @@ function main() {
130124
args[ 0 ] = parseFloat( args[ 0 ] );
131125
args[ 1 ] = parseFloat( args[ 1 ] );
132126

133-
// Get any provided command-line flags:
134-
flags = cli.flags();
135-
136127
opts = {};
137128
if ( flags.iter ) {
138129
opts.iter = parseInt( flags.iter, 10 );
@@ -186,6 +177,17 @@ function main() {
186177
onError( err, code || 1 );
187178
}
188179
}
180+
181+
/**
182+
* Callback invoked upon encountering an error.
183+
*
184+
* @private
185+
* @param {Error} error - error
186+
* @param {integer} [code] - exit code
187+
*/
188+
function onError( error, code ) {
189+
cli.error( error, code || 1 );
190+
}
189191
}
190192

191193
main();

lib/node_modules/@stdlib/random/streams/discrete-uniform/bin/cli

+17-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ var randomStream = require( './../lib' );
3939

4040
// FUNCTIONS //
4141

42-
/**
43-
* Callback invoked upon encountering an error.
44-
*
45-
* @private
46-
* @param {Error} error - error
47-
* @param {integer} [code] - exit code
48-
*/
49-
function onError( error, code ) {
50-
process.exitCode = code || 1;
51-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
52-
}
53-
5442
/**
5543
* Callback invoked once a source stream ends.
5644
*
@@ -118,6 +106,12 @@ function main() {
118106
})
119107
});
120108

109+
// Get any provided command-line options:
110+
flags = cli.flags();
111+
if ( flags.help || flags.version ) {
112+
return;
113+
}
114+
121115
// Get the current working directory:
122116
dir = cwd();
123117

@@ -130,9 +124,6 @@ function main() {
130124
args[ 0 ] = parseInt( args[ 0 ], 10 );
131125
args[ 1 ] = parseInt( args[ 1 ], 10 );
132126

133-
// Get any provided command-line flags:
134-
flags = cli.flags();
135-
136127
opts = {};
137128
if ( flags.iter ) {
138129
opts.iter = parseInt( flags.iter, 10 );
@@ -186,6 +177,17 @@ function main() {
186177
onError( err, code || 1 );
187178
}
188179
}
180+
181+
/**
182+
* Callback invoked upon encountering an error.
183+
*
184+
* @private
185+
* @param {Error} error - error
186+
* @param {integer} [code] - exit code
187+
*/
188+
function onError( error, code ) {
189+
cli.error( error, code || 1 );
190+
}
189191
}
190192

191193
main();

0 commit comments

Comments
 (0)