@thi.ng/args 2.7.0 → 2.7.2
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/CHANGELOG.md +8 -1
- package/README.md +15 -1
- package/package.json +2 -2
- package/parse.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-07-
|
|
3
|
+
- **Last updated**: 2025-07-11T22:07:07Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
### [2.7.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.7.1) (2025-07-11)
|
|
15
|
+
|
|
16
|
+
#### 🩹 Bug fixes
|
|
17
|
+
|
|
18
|
+
- update arg names in parse errors ([5e82c16](https://github.com/thi-ng/umbrella/commit/5e82c16))
|
|
19
|
+
- use kebab-case arg names
|
|
20
|
+
|
|
14
21
|
## [2.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.7.0) (2025-07-10)
|
|
15
22
|
|
|
16
23
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- [Status](#status)
|
|
19
19
|
- [Installation](#installation)
|
|
20
20
|
- [Dependencies](#dependencies)
|
|
21
|
+
- [Projects using this package](#projects-using-this-package)
|
|
21
22
|
- [API](#api)
|
|
22
23
|
- [Basic usage](#basic-usage)
|
|
23
24
|
- [Generate & display help](#generate--display-help)
|
|
@@ -71,7 +72,7 @@ For Node.js REPL:
|
|
|
71
72
|
const args = await import("@thi.ng/args");
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 2.
|
|
75
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 2.99 KB
|
|
75
76
|
|
|
76
77
|
## Dependencies
|
|
77
78
|
|
|
@@ -84,6 +85,19 @@ Package sizes (brotli'd, pre-treeshake): ESM: 2.91 KB
|
|
|
84
85
|
|
|
85
86
|
Note: @thi.ng/api is in _most_ cases a type-only import (not used at runtime)
|
|
86
87
|
|
|
88
|
+
## Projects using this package
|
|
89
|
+
|
|
90
|
+
- [@thi.ng/block-fs](https://thi.ng/block-fs): Customizable block-based storage,
|
|
91
|
+
adapters & file system layer
|
|
92
|
+
- [@thi.ng/meta-css](https://thi.ng/meta-css): Data-driven CSS framework
|
|
93
|
+
codegen, transpiler & bundler
|
|
94
|
+
- [@thi.ng/pointfree-lang](https://thi.ng/pointfree-lang): Forth style syntax
|
|
95
|
+
layer/compiler & CLI for the [@thi.ng/pointfree](https://thi.ng/pointfree) DSL
|
|
96
|
+
- [@thi.ng/tangle](https://thi.ng/tangle): Literate programming code block
|
|
97
|
+
tangling / codegen utility, inspired by org-mode & noweb
|
|
98
|
+
- [@thi.ng/wasm-api-bindgen](https://thi.ng/wasm-api-bindgen): Polyglot bindings
|
|
99
|
+
code generators (TS/JS, Zig, C11) for hybrid WebAssembly projects
|
|
100
|
+
|
|
87
101
|
## API
|
|
88
102
|
|
|
89
103
|
[Generated API docs](https://docs.thi.ng/umbrella/args/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/args",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Declarative, functional CLI argument/options parser, value coercions, sub-commands etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"tag": "cli",
|
|
111
111
|
"year": 2018
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "186d38b07f4ba940a8127cbe2379a38036eff387\n"
|
|
114
114
|
}
|
package/parse.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
2
|
import { defError } from "@thi.ng/errors/deferror";
|
|
3
3
|
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
|
|
4
|
-
import { camel } from "@thi.ng/strings/case";
|
|
4
|
+
import { camel, kebab } from "@thi.ng/strings/case";
|
|
5
5
|
import { usage } from "./usage.js";
|
|
6
6
|
import { __ansi, __colorTheme } from "./utils.js";
|
|
7
7
|
const ParseError = defError(() => "parse error");
|
|
@@ -45,7 +45,7 @@ const __parseOpts = (specs, argv, opts) => {
|
|
|
45
45
|
i++;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
id && illegalArgs(`missing value for: --${id}`);
|
|
48
|
+
id && illegalArgs(`missing value for: --${kebab(id)}`);
|
|
49
49
|
return {
|
|
50
50
|
result: __processResults(specs, acc),
|
|
51
51
|
index: i,
|
|
@@ -94,7 +94,7 @@ const __processResults = (specs, acc) => {
|
|
|
94
94
|
if (spec.default !== void 0) {
|
|
95
95
|
acc[id] = spec.default;
|
|
96
96
|
} else if (spec.optional === false) {
|
|
97
|
-
illegalArgs(`missing arg: --${id}`);
|
|
97
|
+
illegalArgs(`missing arg: --${kebab(id)}`);
|
|
98
98
|
}
|
|
99
99
|
} else if (spec.coerce) {
|
|
100
100
|
__coerceValue(spec, acc, id);
|
|
@@ -112,7 +112,7 @@ const __coerceValue = (spec, acc, id) => {
|
|
|
112
112
|
}
|
|
113
113
|
acc[id] = spec.coerce(acc[id]);
|
|
114
114
|
} catch (e) {
|
|
115
|
-
throw new Error(`arg --${id}: ${e.message}`);
|
|
115
|
+
throw new Error(`arg --${kebab(id)}: ${e.message}`);
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
export {
|