icore 1.0.11 → 1.0.12

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/options.d.ts CHANGED
@@ -36,10 +36,10 @@ export type StringOption<TChoices extends readonly string[] = readonly string[]>
36
36
  * Declarative boolean flag contract.
37
37
  *
38
38
  * Boolean options accept flag form and explicit `true` / `false` values unless
39
- * `flagOnly` is enabled.
39
+ * flag syntax is enforced.
40
40
  */
41
41
  export type BooleanOption = OptionBase<'boolean', boolean> & {
42
- flagOnly?: boolean;
42
+ syntax?: 'flag';
43
43
  };
44
44
  /**
45
45
  * Declarative number option contract.
package/dist/options.js CHANGED
@@ -104,7 +104,7 @@ function parseStringOption(name, definition, value) {
104
104
  return value;
105
105
  }
106
106
  function parseBooleanOption(name, definition, value) {
107
- if (definition.flagOnly === true) {
107
+ if (definition.syntax === 'flag') {
108
108
  if (value === true) {
109
109
  return true;
110
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icore",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Declarative command line interface mechanics for Node.js",
5
5
  "keywords": [
6
6
  "command-line",
package/readme.md CHANGED
@@ -455,19 +455,19 @@ Invalid explicit values are rejected:
455
455
  `--uppercase false` keeps `--uppercase` as `true` and leaves `false` as a positional
456
456
  argument.
457
457
 
458
- Use `flagOnly: true` when a boolean option should accept only flag form:
458
+ Use `syntax: 'flag'` when a boolean option should accept only flag form:
459
459
 
460
460
  ```ts
461
461
  const schema = {
462
462
  uppercase: {
463
463
  type: 'boolean',
464
464
  default: false,
465
- flagOnly: true
465
+ syntax: 'flag'
466
466
  }
467
467
  } as const;
468
468
  ```
469
469
 
470
- With `flagOnly: true`, `--uppercase` is accepted, while `--uppercase=true`,
470
+ With `syntax: 'flag'`, `--uppercase` is accepted, while `--uppercase=true`,
471
471
  `--uppercase=false`, and `--no-uppercase` are rejected.
472
472
 
473
473
  ### `type: 'number'`
@@ -567,7 +567,7 @@ Attached short values such as `-nvalue` and grouped short booleans such as
567
567
  compatibility.
568
568
 
569
569
  Negated syntax such as `--no-cache` is interpreted as `cache: false` when
570
- `cache` is a known boolean option without `flagOnly: true`. Unknown negated
570
+ `cache` is a known boolean option without `syntax: 'flag'`. Unknown negated
571
571
  options, negation for string or number options, and negation for flag-only
572
572
  boolean options are rejected.
573
573