mirror of
https://github.com/sbrl/terrain50-cli.git
synced 2024-11-26 07:33:00 +00:00
Add support for the new parameter of Terrain50.ParseStream()
This commit is contained in:
parent
f7c59bfa90
commit
3c99fd4a4c
3 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,9 @@ npm install --save terrain50-cli
|
|||
-----
|
||||
|
||||
|
||||
## Unreleased
|
||||
- Add new `--use-regex` flag to `validate` subcommand
|
||||
|
||||
## v1.3
|
||||
- Added new `identify` subcommand
|
||||
- Added new `stream-slice` subcommand
|
||||
|
|
|
@ -16,8 +16,8 @@ export default async function(settings) {
|
|||
break;
|
||||
|
||||
case "stream":
|
||||
let i = 0;
|
||||
for await (let next of Terrain50.ParseStream(process.stdin)) {
|
||||
let i = 0
|
||||
for await (let next of Terrain50.ParseStream(process.stdin, settings.cli.use_regex ? /\s+/ : " ")) {
|
||||
console.log(`>>> Item ${i} <<<`);
|
||||
display_errors(next.validate());
|
||||
i++;
|
||||
|
|
|
@ -5,3 +5,9 @@ name = "mode"
|
|||
description = "The mode to operate in. Possible values: validate (default), stream. If stream, then validation will be done on individual items after parsing (otherwise validation is done during parsing, which catches more errors)"
|
||||
default_value = "validate"
|
||||
type = "string"
|
||||
|
||||
[[arguments]]
|
||||
name = "use-regex"
|
||||
description = "When in stream mode, setting this flag causes a regular expression to be used when parsing input data (otherwise it is assumed a single space separates data elements on a line). Makes the parser more tolerant, but less performant."
|
||||
default_value = false
|
||||
type = "boolean"
|
||||
|
|
Loading…
Reference in a new issue