Comparing version 3.2.6 to 3.3.0
@@ -192,2 +192,8 @@ /// <reference types="node" /> | ||
stopAtPositional?: boolean; | ||
/** | ||
* Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, | ||
* will be called with each positional argument encountered. If the function | ||
* returns true, then parsing will stop at that point. | ||
*/ | ||
stopAtPositionalTest?: (arg: string) => boolean; | ||
} | ||
@@ -194,0 +200,0 @@ /** |
@@ -413,3 +413,4 @@ "use strict"; | ||
p.positionals.push(token.value); | ||
if (this.#options.stopAtPositional) { | ||
if (this.#options.stopAtPositional || | ||
this.#options.stopAtPositionalTest?.(token.value)) { | ||
p.positionals.push(...args.slice(token.index + 1)); | ||
@@ -970,4 +971,3 @@ break; | ||
return ('\n```\n' + | ||
split.map(s => `\u200b${s.substring(i)}`) | ||
.join('\n') + | ||
split.map(s => `\u200b${s.substring(i)}`).join('\n') + | ||
'\n```\n'); | ||
@@ -974,0 +974,0 @@ } |
@@ -192,2 +192,8 @@ /// <reference types="node" resolution-mode="require"/> | ||
stopAtPositional?: boolean; | ||
/** | ||
* Conditional `stopAtPositional`. If set to a `(string)=>boolean` function, | ||
* will be called with each positional argument encountered. If the function | ||
* returns true, then parsing will stop at that point. | ||
*/ | ||
stopAtPositionalTest?: (arg: string) => boolean; | ||
} | ||
@@ -194,0 +200,0 @@ /** |
@@ -405,3 +405,4 @@ import { inspect } from 'node:util'; | ||
p.positionals.push(token.value); | ||
if (this.#options.stopAtPositional) { | ||
if (this.#options.stopAtPositional || | ||
this.#options.stopAtPositionalTest?.(token.value)) { | ||
p.positionals.push(...args.slice(token.index + 1)); | ||
@@ -961,4 +962,3 @@ break; | ||
return ('\n```\n' + | ||
split.map(s => `\u200b${s.substring(i)}`) | ||
.join('\n') + | ||
split.map(s => `\u200b${s.substring(i)}`).join('\n') + | ||
'\n```\n'); | ||
@@ -965,0 +965,0 @@ } |
{ | ||
"name": "jackspeak", | ||
"version": "3.2.6", | ||
"version": "3.3.0", | ||
"description": "A very strict and proper argument parser.", | ||
@@ -5,0 +5,0 @@ "tshy": { |
@@ -113,2 +113,8 @@ # jackspeak | ||
- `stopAtPositionalTest` Conditional `stopAtPositional`. Provide | ||
a function that takes a positional argument string and returns | ||
boolean. If it returns `true`, then parsing will stop. Useful | ||
when _some_ subcommands should parse the rest of the command | ||
line options, and others should not. | ||
### `Jack.heading(text: string, level?: 1 | 2 | 3 | 4 | 5 | 6)` | ||
@@ -115,0 +121,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295785
2708
358