1
0
Fork 0
mirror of https://github.com/sbrl/terrain50-cli.git synced 2024-11-29 08:02:59 +00:00

Add support for the new parameter of Terrain50.ParseStream()

This commit is contained in:
Starbeamrainbowlabs 2020-07-16 17:07:25 +01:00
parent f7c59bfa90
commit 3c99fd4a4c
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 11 additions and 2 deletions

View file

@ -14,6 +14,9 @@ npm install --save terrain50-cli
----- -----
## Unreleased
- Add new `--use-regex` flag to `validate` subcommand
## v1.3 ## v1.3
- Added new `identify` subcommand - Added new `identify` subcommand
- Added new `stream-slice` subcommand - Added new `stream-slice` subcommand

View file

@ -16,8 +16,8 @@ export default async function(settings) {
break; break;
case "stream": case "stream":
let i = 0; let i = 0
for await (let next of Terrain50.ParseStream(process.stdin)) { for await (let next of Terrain50.ParseStream(process.stdin, settings.cli.use_regex ? /\s+/ : " ")) {
console.log(`>>> Item ${i} <<<`); console.log(`>>> Item ${i} <<<`);
display_errors(next.validate()); display_errors(next.validate());
i++; i++;

View file

@ -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)" 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" default_value = "validate"
type = "string" 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"