@thi.ng/args 3.1.0 → 3.1.5

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.
Files changed (4) hide show
  1. package/args.d.ts +2 -2
  2. package/args.js +1 -1
  3. package/package.json +113 -113
  4. package/CHANGELOG.md +0 -174
package/args.d.ts CHANGED
@@ -151,12 +151,12 @@ export declare const oneOf: <K extends string, S extends ArgDef | ArgDefRequired
151
151
  * @param opts -
152
152
  * @param spec -
153
153
  */
154
- export declare const oneOfMulti: <K extends string, S extends ArgDef | ArgDefRequired<K>>(spec: S & {
154
+ export declare const oneOfMulti: <K extends string, S extends ArgDef | ArgDefRequired<K[]>>(spec: S & {
155
155
  opts: readonly K[];
156
156
  delim?: string;
157
157
  }) => S & {
158
158
  type: "oneOfMulti";
159
- coerce: Fn<string, K>;
159
+ coerce: Fn<string[], K[]>;
160
160
  desc: string;
161
161
  hint: string;
162
162
  group: string;
package/args.js CHANGED
@@ -52,7 +52,7 @@ const oneOf = (spec) => ({
52
52
  const oneOfMulti = (spec) => ({
53
53
  ...spec,
54
54
  type: "oneOfMulti",
55
- coerce: coerceOneOf(spec.opts),
55
+ coerce: (vals) => vals.map(coerceOneOf(spec.opts)),
56
56
  hint: spec.hint ?? __hint("ID", spec.delim),
57
57
  group: spec.group ?? "main",
58
58
  desc: __desc(spec.opts, spec.desc),
package/package.json CHANGED
@@ -1,114 +1,114 @@
1
1
  {
2
- "name": "@thi.ng/args",
3
- "version": "3.1.0",
4
- "description": "Declarative, functional CLI argument/options parser, app framework, arg value coercions, multi/sub-commands, usage generation, error handling etc.",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
12
- },
13
- "homepage": "https://thi.ng/args",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- },
23
- {
24
- "type": "liberapay",
25
- "url": "https://liberapay.com/thi.ng"
26
- }
27
- ],
28
- "author": "Karsten Schmidt (https://thi.ng)",
29
- "license": "Apache-2.0",
30
- "scripts": {
31
- "build": "yarn build:esbuild && yarn build:decl",
32
- "build:decl": "tsc --declaration --emitDeclarationOnly",
33
- "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
34
- "clean": "bun ../../tools/src/clean-package.ts",
35
- "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
36
- "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
37
- "pub": "yarn npm publish --access public",
38
- "test": "bun test",
39
- "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
- },
41
- "dependencies": {
42
- "@thi.ng/api": "^8.12.2",
43
- "@thi.ng/checks": "^3.7.18",
44
- "@thi.ng/errors": "^2.5.42",
45
- "@thi.ng/logger": "^3.2.0",
46
- "@thi.ng/strings": "^3.9.22",
47
- "@thi.ng/text-format": "^2.2.41"
48
- },
49
- "devDependencies": {
50
- "@types/node": "^24.3.0",
51
- "esbuild": "^0.25.9",
52
- "typedoc": "^0.28.12",
53
- "typescript": "^5.9.2"
54
- },
55
- "keywords": [
56
- "ansi",
57
- "argument",
58
- "cli",
59
- "coerce",
60
- "color",
61
- "conversion",
62
- "declarative",
63
- "functional",
64
- "hex",
65
- "logger",
66
- "no-browser",
67
- "nodejs",
68
- "parser",
69
- "tuple",
70
- "typescript",
71
- "validate"
72
- ],
73
- "publishConfig": {
74
- "access": "public"
75
- },
76
- "engines": {
77
- "node": ">=18"
78
- },
79
- "files": [
80
- "./*.js",
81
- "./*.d.ts"
82
- ],
83
- "exports": {
84
- ".": {
85
- "default": "./index.js"
86
- },
87
- "./api": {
88
- "default": "./api.js"
89
- },
90
- "./args": {
91
- "default": "./args.js"
92
- },
93
- "./cli": {
94
- "default": "./cli.js"
95
- },
96
- "./coerce": {
97
- "default": "./coerce.js"
98
- },
99
- "./header": {
100
- "default": "./header.js"
101
- },
102
- "./parse": {
103
- "default": "./parse.js"
104
- },
105
- "./usage": {
106
- "default": "./usage.js"
107
- }
108
- },
109
- "thi.ng": {
110
- "tag": "cli",
111
- "year": 2018
112
- },
113
- "gitHead": "d86306c5375d19fa95bc900e433d097226516b1e\n"
114
- }
2
+ "name": "@thi.ng/args",
3
+ "version": "3.1.5",
4
+ "description": "Declarative, functional CLI argument/options parser, app framework, arg value coercions, multi/sub-commands, usage generation, error handling etc.",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://thi.ng/args",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
18
+ },
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ },
23
+ {
24
+ "type": "liberapay",
25
+ "url": "https://liberapay.com/thi.ng"
26
+ }
27
+ ],
28
+ "author": "Karsten Schmidt (https://thi.ng)",
29
+ "license": "Apache-2.0",
30
+ "scripts": {
31
+ "build": "yarn build:esbuild && yarn build:decl",
32
+ "build:decl": "tsc --declaration --emitDeclarationOnly",
33
+ "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
34
+ "clean": "bun ../../tools/src/clean-package.ts",
35
+ "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
36
+ "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
37
+ "pub": "npm publish --access public",
38
+ "test": "bun test",
39
+ "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
+ },
41
+ "dependencies": {
42
+ "@thi.ng/api": "^8.12.6",
43
+ "@thi.ng/checks": "^3.7.22",
44
+ "@thi.ng/errors": "^2.5.46",
45
+ "@thi.ng/logger": "^3.2.5",
46
+ "@thi.ng/strings": "^3.9.26",
47
+ "@thi.ng/text-format": "^2.2.45"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^24.9.1",
51
+ "esbuild": "^0.25.11",
52
+ "typedoc": "^0.28.14",
53
+ "typescript": "^5.9.3"
54
+ },
55
+ "keywords": [
56
+ "ansi",
57
+ "argument",
58
+ "cli",
59
+ "coerce",
60
+ "color",
61
+ "conversion",
62
+ "declarative",
63
+ "functional",
64
+ "hex",
65
+ "logger",
66
+ "no-browser",
67
+ "nodejs",
68
+ "parser",
69
+ "tuple",
70
+ "typescript",
71
+ "validate"
72
+ ],
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "engines": {
77
+ "node": ">=18"
78
+ },
79
+ "files": [
80
+ "./*.js",
81
+ "./*.d.ts"
82
+ ],
83
+ "exports": {
84
+ ".": {
85
+ "default": "./index.js"
86
+ },
87
+ "./api": {
88
+ "default": "./api.js"
89
+ },
90
+ "./args": {
91
+ "default": "./args.js"
92
+ },
93
+ "./cli": {
94
+ "default": "./cli.js"
95
+ },
96
+ "./coerce": {
97
+ "default": "./coerce.js"
98
+ },
99
+ "./header": {
100
+ "default": "./header.js"
101
+ },
102
+ "./parse": {
103
+ "default": "./parse.js"
104
+ },
105
+ "./usage": {
106
+ "default": "./usage.js"
107
+ }
108
+ },
109
+ "thi.ng": {
110
+ "tag": "cli",
111
+ "year": 2018
112
+ },
113
+ "gitHead": "136a5e5ef0b69e82329db00d806c3c4e8f1aa063\n"
114
+ }
package/CHANGELOG.md DELETED
@@ -1,174 +0,0 @@
1
- # Change Log
2
-
3
- - **Last updated**: 2025-09-26T13:50:05Z
4
- - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
-
6
- All notable changes to this project will be documented in this file.
7
- Only versions published since **2022-01-01** are listed here.
8
- Please consult the Git history for older version information.
9
- See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
10
-
11
- **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
- and/or version bumps of transitive dependencies.
13
-
14
- ## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@3.1.0) (2025-09-26)
15
-
16
- #### 🚀 Features
17
-
18
- - add ARG_TYPES index ([5f68489](https://github.com/thi-ng/umbrella/commit/5f68489))
19
-
20
- #### ♻️ Refactoring
21
-
22
- - update factory fns to only take single arg (spec) ([2766125](https://github.com/thi-ng/umbrella/commit/2766125))
23
- - update `oneOf`, `oneOfMulti`, `tuple`, `size`, `vec`
24
- - fix `required`-handling in `ARG_OUT_DIR` & `ARG_OUT_FILE` presets
25
- - fix code example for `tuple()`
26
- - update tests
27
-
28
- # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@3.0.0) (2025-09-26)
29
-
30
- #### 🛑 Breaking changes
31
-
32
- - update arg specs & arg factory fns, simplify types ([7ad3efb](https://github.com/thi-ng/umbrella/commit/7ad3efb))
33
- - BREAKING CHANGES: update arg specs & arg factory fns, simplify types
34
- - add `type` field in all arg specs
35
- - add/update arg-related types
36
- - update required arg handling: `optional: false` => `required: true`
37
- - update delimiter handling (move into arg specs)
38
- - update `tuple()` arg order
39
- - remove obsolete coercion fns (`coerceFloats()` etc.)
40
- - update tests
41
-
42
- ## [2.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.10.0) (2025-09-04)
43
-
44
- #### 🚀 Features
45
-
46
- - update cliApp() to show current cmd info w/ usage ([2991527](https://github.com/thi-ng/umbrella/commit/2991527))
47
-
48
- ## [2.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.9.0) (2025-08-06)
49
-
50
- #### 🚀 Features
51
-
52
- - add arg preset specs ([2b13af5](https://github.com/thi-ng/umbrella/commit/2b13af5))
53
- - add ARG_DRY_RUN
54
- - add ARG_QUIET, ARG_VERBOSE
55
- - add ARG_OUT_DIR, ARG_OUT_FILE
56
- - add configureLogLevel() ([ea5c6e4](https://github.com/thi-ng/umbrella/commit/ea5c6e4))
57
-
58
- ## [2.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.8.0) (2025-07-12)
59
-
60
- #### 🚀 Features
61
-
62
- - update `Command`, support min/max input ranges ([471543e](https://github.com/thi-ng/umbrella/commit/471543e))
63
- - update cliApp() input checks & error messages
64
-
65
- ### [2.7.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.7.1) (2025-07-11)
66
-
67
- #### 🩹 Bug fixes
68
-
69
- - update arg names in parse errors ([5e82c16](https://github.com/thi-ng/umbrella/commit/5e82c16))
70
- - use kebab-case arg names
71
-
72
- ## [2.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.7.0) (2025-07-10)
73
-
74
- #### 🚀 Features
75
-
76
- - add `terminalLineWidth()` helper ([e8fdd27](https://github.com/thi-ng/umbrella/commit/e8fdd27))
77
- - update ColorTheme and error msg output ([c2bca13](https://github.com/thi-ng/umbrella/commit/c2bca13))
78
-
79
- #### ♻️ Refactoring
80
-
81
- - simplify error handling in cliApp() ([9973cf0](https://github.com/thi-ng/umbrella/commit/9973cf0))
82
-
83
- ### [2.6.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.6.3) (2025-07-09)
84
-
85
- #### 🩹 Bug fixes
86
-
87
- - update parse logic to allow option values starting with `-` ([8a9050d](https://github.com/thi-ng/umbrella/commit/8a9050d))
88
- - disable regex check in `__parseValue()`
89
- - add tests
90
-
91
- ## [2.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.6.0) (2025-06-28)
92
-
93
- #### 🚀 Features
94
-
95
- - emit colorized error messages in cliApp() ([36f66b6](https://github.com/thi-ng/umbrella/commit/36f66b6))
96
-
97
- ## [2.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.5.0) (2025-06-27)
98
-
99
- #### 🚀 Features
100
-
101
- - update ColorTheme, add color support for cmd list ([75b1ef1](https://github.com/thi-ng/umbrella/commit/75b1ef1))
102
- - add `ColorTheme.command` option
103
- - migrate internal formatting helpers to own file
104
- - refactor cliApp() & usage() internals
105
- - add thi.ng logo header tpl ([838e417](https://github.com/thi-ng/umbrella/commit/838e417))
106
-
107
- ## [2.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.4.0) (2025-06-27)
108
-
109
- #### 🚀 Features
110
-
111
- - add word-wrapping for command descriptions ([46a73a3](https://github.com/thi-ng/umbrella/commit/46a73a3))
112
- - refactor usage internals for better re-use
113
-
114
- ### [2.3.34](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.3.34) (2024-06-21)
115
-
116
- #### ♻️ Refactoring
117
-
118
- - rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
119
- - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
120
-
121
- ### [2.3.31](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.3.31) (2024-04-20)
122
-
123
- #### ♻️ Refactoring
124
-
125
- - update type usage ([68dd6a2](https://github.com/thi-ng/umbrella/commit/68dd6a2))
126
-
127
- ### [2.3.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.3.2) (2023-12-26)
128
-
129
- #### 🩹 Bug fixes
130
-
131
- - update word wrap behavior in usage() ([60b1580](https://github.com/thi-ng/umbrella/commit/60b1580))
132
-
133
- ## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.3.0) (2023-12-18)
134
-
135
- #### 🚀 Features
136
-
137
- - add cliApp() runner ([b2248fa](https://github.com/thi-ng/umbrella/commit/b2248fa))
138
- - update lifecycle hooks, add NO_COLOR support, add docs ([4a0ebda](https://github.com/thi-ng/umbrella/commit/4a0ebda))
139
- - add CLIAppConfig pre/post lifecycle hooks
140
- - update UsageOpts.color handling
141
- - add `NO_COLOR` env var support in cliApp()
142
- - add doc strings
143
- - update deps
144
- - update cliApp() to support command context extensions ([61d9fb8](https://github.com/thi-ng/umbrella/commit/61d9fb8))
145
- - update cliApp() error handling ([019e5a1](https://github.com/thi-ng/umbrella/commit/019e5a1))
146
- - update argv handling in cliApp() ([b1ed768](https://github.com/thi-ng/umbrella/commit/b1ed768))
147
- - add NO_COLOR aware formatters to CommandCtx ([0e7ddda](https://github.com/thi-ng/umbrella/commit/0e7ddda))
148
- - update deps
149
- - update cliApp() to use StreamLogger (target: process.stderr) ([b249295](https://github.com/thi-ng/umbrella/commit/b249295))
150
-
151
- ### [2.2.28](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.2.28) (2023-08-04)
152
-
153
- #### ♻️ Refactoring
154
-
155
- - update `identity` usage in various pkgs ([b6db053](https://github.com/thi-ng/umbrella/commit/b6db053))
156
-
157
- ### [2.2.15](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.2.15) (2022-12-29)
158
-
159
- #### ♻️ Refactoring
160
-
161
- - update "no-browser" pkg handling ([0e84f1b](https://github.com/thi-ng/umbrella/commit/0e84f1b))
162
-
163
- ## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.2.0) (2022-08-15)
164
-
165
- #### 🚀 Features
166
-
167
- - add ParseError, update parse() err handling ([c854a13](https://github.com/thi-ng/umbrella/commit/c854a13))
168
- - update parse() to re-throw any caught error wrapped as ParseError
169
-
170
- ### [2.1.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/args@2.1.6) (2022-04-07)
171
-
172
- #### ♻️ Refactoring
173
-
174
- - replace deprecated .substr() w/ .substring() ([0710509](https://github.com/thi-ng/umbrella/commit/0710509))