Skip to content

Commit 8608463

Browse files
committed
Update CLIs
1 parent b45b681 commit 8608463

File tree

2 files changed

+28
-27
lines changed
  • lib/node_modules/@stdlib/_tools/utils
    • rawgit-url/bin
    • tex-equation-to-svg/bin

2 files changed

+28
-27
lines changed

lib/node_modules/@stdlib/_tools/utils/rawgit-url/bin/cli

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,14 @@ function main() {
102102
})
103103
});
104104

105-
// Get any provided command-line arguments:
106-
args = cli.args();
107-
108105
// Get any provided command-line options:
109106
flags = cli.flags();
107+
if ( flags.help || flags.version ) {
108+
return;
109+
}
110+
111+
// Get any provided command-line arguments:
112+
args = cli.args();
110113

111114
opts = {};
112115
opts.file = args[ 0 ];
@@ -119,8 +122,7 @@ function main() {
119122
fcn = wrap( getSlug );
120123
tmp = fcn();
121124
if ( instanceOf( tmp, Error ) ) {
122-
process.exitCode = 1;
123-
return console.error( 'Error: %s', '\nError encountered while generating a RawGit URL. If no slug is provided, ensure that the current working directory is a Git repository.\n\n' ); // eslint-disable-line no-console
125+
return cli.error( new Error( '\nError encountered while generating a RawGit URL. If no slug is provided, ensure that the current working directory is a Git repository.\n\n' ) );
124126
}
125127
opts.slug = tmp;
126128
}

lib/node_modules/@stdlib/_tools/utils/tex-equation-to-svg/bin/cli

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,6 @@ var CLI = require( '@stdlib/tools/cli' );
2828
var tex2svg = require( './../lib' );
2929

3030

31-
// FUNCTIONS //
32-
33-
/**
34-
* Callback invoked upon converting an input string to an SVG.
35-
*
36-
* @private
37-
* @param {(Error|null)} error - error object
38-
* @param {string} svg - output SVG
39-
* @returns {void}
40-
*/
41-
function clbk( error, svg ) {
42-
if ( error ) {
43-
process.exitCode = 1;
44-
return console.error( error.message ); // eslint-disable-line no-console
45-
}
46-
console.log( svg ); // eslint-disable-line no-console
47-
}
48-
49-
5031
// MAIN //
5132

5233
/**
@@ -69,12 +50,15 @@ function main() {
6950
})
7051
});
7152

53+
// Get any provided command-line options:
54+
flags = cli.flags();
55+
if ( flags.help || flags.version ) {
56+
return;
57+
}
58+
7259
// Get any provided command-line arguments:
7360
args = cli.args();
7461

75-
// Get any provided command-line flags:
76-
flags = cli.flags();
77-
7862
opts = {};
7963
if ( flags.width ) {
8064
opts.width = parseInt( flags.width, 10 );
@@ -89,6 +73,21 @@ function main() {
8973
opts.linebreaks = false;
9074
}
9175
tex2svg( args[ 0 ], opts, clbk );
76+
77+
/**
78+
* Callback invoked upon converting an input string to an SVG.
79+
*
80+
* @private
81+
* @param {(Error|null)} error - error object
82+
* @param {string} svg - output SVG
83+
* @returns {void}
84+
*/
85+
function clbk( error, svg ) {
86+
if ( error ) {
87+
return cli.error( error );
88+
}
89+
console.log( svg ); // eslint-disable-line no-console
90+
}
9291
}
9392

9493
main();

0 commit comments

Comments
 (0)