Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 6dee30e

Browse files
committed
tweak help a bit.
1 parent d49bd0c commit 6dee30e

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

babel-external-helpers.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,31 @@ function help(exitcode) {
169169
console.log("Options:");
170170
console.log(" -o [outfile] Write output to file.");
171171
console.log(" -h, --help Display usage information.");
172-
console.log(" -l, --whitelist [list Whitelist of helpers to ONLY include.");
172+
console.log(" -l, --whitelist [list] Whitelist of helpers to ONLY include.");
173173
console.log(" -t, --output-type [type] Type of output (export|global|umd|var).");
174174

175175
process.exit(exitcode);
176176
}
177177

178+
function version() {
179+
var pkg = require('./package.json');
180+
console.log(`better-babel-external-helpers version ${pkg.version}`);
181+
}
178182

179-
var argv = getopt_long(null, "hl:t:o:", ["help","whitelist=s","output-type=s"], function(arg, optarg){
183+
var argv = getopt_long(null, "hl:t:o:V", ["help","whitelist=s","output-type=s", "version"], function(arg, optarg){
180184

181185
switch(arg) {
182186
case 'help':
183187
case 'h':
184188
help(EX.OK);
185189
break;
190+
191+
case 'V':
192+
case 'version':
193+
version();
194+
process.exit(EX.OK);
195+
break;
196+
186197
case 'l':
187198
case 'whitelist':
188199
opts.l = optarg.split(',')

babel.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function version() {
9494

9595
function help_presets(verbose) {
9696

97-
console.log("presets:");
97+
console.log("Presets:");
9898

9999
var x = [];
100100
data.presets.forEach(function(v,k) { x.push(k); });
@@ -116,7 +116,7 @@ function help_presets(verbose) {
116116

117117
function help_plugins() {
118118

119-
console.log("plugins:");
119+
console.log("Plugins:");
120120

121121
var x = [];
122122
data.plugins.forEach(function(k) { x.push(k); });
@@ -131,7 +131,7 @@ function config_str(o) {
131131
}
132132
function help_config() {
133133

134-
console.log("configuration:");
134+
console.log("Configuration:");
135135

136136
data.config.forEach(function(v, k) {
137137
console.log(`--${k} ${config_str(v)}`);
@@ -142,24 +142,28 @@ function help(exitcode) {
142142

143143
console.log("babel [options] infile...");
144144
console.log("");
145-
console.log("options:");
146-
console.log(" -o outfile");
147-
console.log(" -h / --help");
148-
console.log(" -v / --[no-]verbose");
149-
console.log(" -V / --version");
150-
console.log(" --[no-]babelrc");
151-
console.log(" --[no-]comments");
152-
console.log(" --[no-]compact");
153-
console.log(" --loose");
154-
console.log(" --preset");
155-
console.log(" --[no-]plugin");
156-
145+
console.log("Options:");
146+
console.log(" -o [outfile] Write output to file.");
147+
console.log(" -h, --help Display usage information.");
148+
console.log(" --help-presets Display presets.");
149+
console.log(" --help-plugins Display plugins.");
150+
console.log(" --help-config Display plugin configuration.");
151+
console.log(" -v, --[no-]verbose Enable/Disable verbose mode.");
152+
console.log(" -V, --version Display version information.");
153+
console.log(" --[no-]babelrc Enable/Disable .babelrc.");
154+
console.log(" --[no-]comments Enable/Disable comments.");
155+
console.log(" --[no-]compact Enable/Disable compaction.");
156+
console.log(" --loose Enable loose mode.");
157+
console.log(" --preset [name] Enable specified preset.");
158+
console.log(" --[no-]plugin [plugin] Enable/Disable specified plugin.");
159+
160+
/*
157161
console.log("");
158162
help_presets();
159163
160164
console.log("");
161165
help_plugins();
162-
166+
*/
163167
process.exit(exitcode);
164168
}
165169

0 commit comments

Comments
 (0)