@oclif/core 1.14.1 → 1.14.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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.14.2](https://github.com/oclif/core/compare/v1.14.1...v1.14.2) (2022-08-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add overloads to enum flag ([799455b](https://github.com/oclif/core/commit/799455bbb526b221c806bf8feff6b625dcf50a56))
11
+
5
12
  ### [1.14.1](https://github.com/oclif/core/compare/v1.14.0...v1.14.1) (2022-08-16)
6
13
 
7
14
 
package/lib/flags.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OptionFlag, Definition, BooleanFlag, EnumFlagOptions } from './interfaces';
1
+ import { OptionFlag, Definition, BooleanFlag, EnumFlagOptions, Default } from './interfaces';
2
2
  export declare function build<T>(defaults: {
3
3
  parse: OptionFlag<T>['parse'];
4
4
  } & Partial<OptionFlag<T>>): Definition<T>;
@@ -6,7 +6,22 @@ export declare function build(defaults: Partial<OptionFlag<string>>): Definition
6
6
  export declare function option<T>(options: {
7
7
  parse: OptionFlag<T>['parse'];
8
8
  } & Partial<OptionFlag<T>>): OptionFlag<T | undefined>;
9
- declare const _enum: <T = string>(opts: EnumFlagOptions<T>) => OptionFlag<T>;
9
+ export declare function _enum<T = string>(opts: EnumFlagOptions<T> & {
10
+ multiple: true;
11
+ } & ({
12
+ required: true;
13
+ } | {
14
+ default: Default<T>;
15
+ })): OptionFlag<T[]>;
16
+ export declare function _enum<T = string>(opts: EnumFlagOptions<T> & {
17
+ multiple: true;
18
+ }): OptionFlag<T[] | undefined>;
19
+ export declare function _enum<T = string>(opts: EnumFlagOptions<T> & ({
20
+ required: true;
21
+ } | {
22
+ default: Default<T>;
23
+ })): OptionFlag<T>;
24
+ export declare function _enum<T = string>(opts: EnumFlagOptions<T>): OptionFlag<T | undefined>;
10
25
  export { _enum as enum };
11
26
  declare const stringFlag: Definition<string>;
12
27
  export { stringFlag as string };
package/lib/flags.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.help = exports.version = exports.file = exports.directory = exports.url = exports.integer = exports.boolean = exports.string = exports.enum = exports.option = exports.build = void 0;
3
+ exports.help = exports.version = exports.file = exports.directory = exports.url = exports.integer = exports.boolean = exports.string = exports.enum = exports._enum = exports.option = exports.build = void 0;
4
4
  const Parser = require("./parser");
5
5
  function build(defaults) {
6
6
  return Parser.flags.build(defaults);
@@ -10,7 +10,7 @@ function option(options) {
10
10
  return build(options)();
11
11
  }
12
12
  exports.option = option;
13
- const _enum = (opts) => {
13
+ function _enum(opts) {
14
14
  return build({
15
15
  async parse(input) {
16
16
  if (!opts.options.includes(input))
@@ -20,7 +20,8 @@ const _enum = (opts) => {
20
20
  helpValue: `(${opts.options.join('|')})`,
21
21
  ...opts,
22
22
  })();
23
- };
23
+ }
24
+ exports._enum = _enum;
24
25
  exports.enum = _enum;
25
26
  const stringFlag = build({});
26
27
  exports.string = stringFlag;
@@ -77,7 +77,7 @@ export declare function file(opts: {
77
77
  } & Partial<OptionFlag<string>> & ({
78
78
  required: true;
79
79
  } | {
80
- default: string;
80
+ default: Default<string>;
81
81
  })): OptionFlag<string>;
82
82
  export declare function file(opts?: {
83
83
  exists?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "1.14.1",
4
+ "version": "1.14.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {