@optique/run 1.0.0-dev.751 → 1.0.0-dev.764
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/valueparser.cjs +4 -0
- package/dist/valueparser.d.cts +6 -0
- package/dist/valueparser.d.ts +6 -0
- package/dist/valueparser.js +4 -0
- package/package.json +2 -2
package/dist/valueparser.cjs
CHANGED
|
@@ -54,6 +54,10 @@ function path(options = {}) {
|
|
|
54
54
|
$mode: "sync",
|
|
55
55
|
metavar,
|
|
56
56
|
parse(input) {
|
|
57
|
+
if (input.trim() === "") return {
|
|
58
|
+
success: false,
|
|
59
|
+
error: options.errors?.emptyPath ? typeof options.errors.emptyPath === "function" ? options.errors.emptyPath(input) : options.errors.emptyPath : __optique_core_message.message`Path must not be empty.`
|
|
60
|
+
};
|
|
57
61
|
if (extensions && extensions.length > 0) {
|
|
58
62
|
const base = /[/\\]$/.test(input) ? "" : (0, node_path.basename)(input);
|
|
59
63
|
if (!extensions.some((ext) => base.endsWith(ext))) {
|
package/dist/valueparser.d.cts
CHANGED
|
@@ -9,6 +9,12 @@ import { ValueParser } from "@optique/core/valueparser";
|
|
|
9
9
|
* @since 0.5.0
|
|
10
10
|
*/
|
|
11
11
|
interface PathErrorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Custom error message when the path is empty or contains only whitespace.
|
|
14
|
+
* Can be a static message or a function that receives the raw input string.
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
emptyPath?: Message | ((input: string) => Message);
|
|
12
18
|
/**
|
|
13
19
|
* Custom error message when file extension is invalid.
|
|
14
20
|
* Can be a static message or a function that receives input, expected
|
package/dist/valueparser.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ import { ValueParser } from "@optique/core/valueparser";
|
|
|
9
9
|
* @since 0.5.0
|
|
10
10
|
*/
|
|
11
11
|
interface PathErrorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Custom error message when the path is empty or contains only whitespace.
|
|
14
|
+
* Can be a static message or a function that receives the raw input string.
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
emptyPath?: Message | ((input: string) => Message);
|
|
12
18
|
/**
|
|
13
19
|
* Custom error message when file extension is invalid.
|
|
14
20
|
* Can be a static message or a function that receives input, expected
|
package/dist/valueparser.js
CHANGED
|
@@ -53,6 +53,10 @@ function path(options = {}) {
|
|
|
53
53
|
$mode: "sync",
|
|
54
54
|
metavar,
|
|
55
55
|
parse(input) {
|
|
56
|
+
if (input.trim() === "") return {
|
|
57
|
+
success: false,
|
|
58
|
+
error: options.errors?.emptyPath ? typeof options.errors.emptyPath === "function" ? options.errors.emptyPath(input) : options.errors.emptyPath : message`Path must not be empty.`
|
|
59
|
+
};
|
|
56
60
|
if (extensions && extensions.length > 0) {
|
|
57
61
|
const base = /[/\\]$/.test(input) ? "" : basename(input);
|
|
58
62
|
if (!extensions.some((ext) => base.endsWith(ext))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/run",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.764+b6aec70a",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@optique/core": "1.0.0-dev.
|
|
73
|
+
"@optique/core": "1.0.0-dev.764+b6aec70a"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|