edf2csv 0.7.45 → 0.7.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -215,6 +215,29 @@ export async function main(argv) {
215
215
  process.stderr.write(`No input file given.\n\n${USAGE}`);
216
216
  return EXIT_USAGE;
217
217
  }
218
+ /*
219
+ An empty --out, refused here rather than by the filesystem.
220
+
221
+ Every other option that takes a value refuses an empty one from the command line and says
222
+ what it wanted: `--start is empty`, `--channels was given but lists no channel names`,
223
+ `--layout must be "wide" or "long", got ""`. `--out ""` was the eighth of eight and the
224
+ exception — it went the whole way to `mkdir('')` and came back as a conversion failure
225
+ about a path:
226
+
227
+ error: Cannot create "": part of the path does not exist.
228
+ Check the path exists and that you have permission to write there.
229
+
230
+ Exit 1 where the other seven are exit 2, advice about a path and a permission for a value
231
+ that is neither, and in a batch it is decided once per recording rather than once for the
232
+ run. `--out "$DEST"` with `DEST` unset is how it gets written by accident, which is also
233
+ why the empty string alone is refused and the value is not trimmed first: a directory whose
234
+ name is a space is a strange thing to ask for, but it is a thing the filesystem has and a
235
+ path is not a keyword.
236
+ */
237
+ if (values['out'] === '') {
238
+ process.stderr.write('error: --out is empty. Give a directory, for example --out ./converted.\n');
239
+ return EXIT_USAGE;
240
+ }
218
241
  let expanded;
219
242
  let unreadable;
220
243
  let namedDirectory;