@oclif/core 1.13.1 → 1.13.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.13.2](https://github.com/oclif/core/compare/v1.13.1...v1.13.2) (2022-08-05)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * flag types ([#454](https://github.com/oclif/core/issues/454)) ([2938ba4](https://github.com/oclif/core/commit/2938ba4082d1b0c603a55678fe47f5beed9acbb5))
11
+
5
12
  ### [1.13.1](https://github.com/oclif/core/compare/v1.13.0...v1.13.1) (2022-08-02)
6
13
 
7
14
 
package/lib/command.d.ts CHANGED
@@ -65,13 +65,13 @@ export default abstract class Command {
65
65
  * @param {Interfaces.LoadOptions} opts options
66
66
  */
67
67
  static run: Interfaces.Command.Class['run'];
68
- protected static _globalFlags: Interfaces.FlagInput<any>;
69
- static get globalFlags(): Interfaces.FlagInput<any>;
70
- static set globalFlags(flags: Interfaces.FlagInput<any>);
68
+ protected static _globalFlags: Interfaces.FlagInput;
69
+ static get globalFlags(): Interfaces.FlagInput;
70
+ static set globalFlags(flags: Interfaces.FlagInput);
71
71
  /** A hash of flags for the command */
72
- protected static _flags: Interfaces.FlagInput<any>;
73
- static get flags(): Interfaces.FlagInput<any>;
74
- static set flags(flags: Interfaces.FlagInput<any>);
72
+ protected static _flags: Interfaces.FlagInput;
73
+ static get flags(): Interfaces.FlagInput;
74
+ static set flags(flags: Interfaces.FlagInput);
75
75
  id: string | undefined;
76
76
  protected debug: (...args: any[]) => void;
77
77
  constructor(argv: string[], config: Config);
@@ -95,9 +95,9 @@ export default abstract class Command {
95
95
  */
96
96
  abstract run(): PromiseLike<any>;
97
97
  protected init(): Promise<any>;
98
- protected parse<F, A extends {
98
+ protected parse<F, G, A extends {
99
99
  [name: string]: any;
100
- }>(options?: Interfaces.Input<F>, argv?: string[]): Promise<Interfaces.ParserOutput<F, A>>;
100
+ }>(options?: Interfaces.Input<F, G>, argv?: string[]): Promise<Interfaces.ParserOutput<F, G, A>>;
101
101
  protected catch(err: Error & {
102
102
  exitCode?: number;
103
103
  }): Promise<any>;
package/lib/command.js CHANGED
@@ -129,7 +129,7 @@ class Command {
129
129
  options = this.constructor;
130
130
  const opts = { context: this, ...options };
131
131
  // the spread operator doesn't work with getters so we have to manually add it here
132
- opts.flags = Object.assign({}, options?.flags, options?.globalFlags);
132
+ opts.flags = options?.flags;
133
133
  return Parser.parse(argv, opts);
134
134
  }
135
135
  async catch(err) {
@@ -37,7 +37,7 @@ export declare type ArgInput = Arg<any>[];
37
37
  export interface CLIParseErrorOptions {
38
38
  parse: {
39
39
  input?: ParserInput;
40
- output?: ParserOutput<any, any>;
40
+ output?: ParserOutput;
41
41
  };
42
42
  }
43
43
  export declare type OutputArgs = {
@@ -46,8 +46,8 @@ export declare type OutputArgs = {
46
46
  export declare type OutputFlags<T extends ParserInput['flags']> = {
47
47
  [P in keyof T]: any;
48
48
  };
49
- export declare type ParserOutput<TFlags extends OutputFlags<any>, TArgs extends OutputArgs> = {
50
- flags: TFlags & {
49
+ export declare type ParserOutput<TFlags extends OutputFlags<any> = any, GFlags extends OutputFlags<any> = any, TArgs extends OutputArgs = any> = {
50
+ flags: TFlags & GFlags & {
51
51
  json: boolean | undefined;
52
52
  };
53
53
  args: TArgs;
@@ -158,9 +158,9 @@ export declare type EnumFlagOptions<T> = Partial<OptionFlag<T>> & {
158
158
  options: T[];
159
159
  };
160
160
  export declare type Flag<T> = BooleanFlag<T> | OptionFlag<T>;
161
- export declare type Input<TFlags extends FlagOutput> = {
161
+ export declare type Input<TFlags extends FlagOutput, GFlags extends FlagOutput> = {
162
162
  flags?: FlagInput<TFlags>;
163
- globalFlags?: FlagInput<TFlags>;
163
+ globalFlags?: FlagInput<GFlags>;
164
164
  args?: ArgInput;
165
165
  strict?: boolean;
166
166
  context?: any;
@@ -194,7 +194,9 @@ export declare type CompletableOptionFlag<T> = OptionFlag<T> & {
194
194
  completion?: Completion;
195
195
  };
196
196
  export declare type CompletableFlag<T> = BooleanFlag<T> | CompletableOptionFlag<T>;
197
- export declare type FlagInput<T extends FlagOutput> = {
197
+ export declare type FlagInput<T extends FlagOutput = {
198
+ [flag: string]: unknown;
199
+ }> = {
198
200
  [P in keyof T]: CompletableFlag<T[P]>;
199
201
  };
200
202
  export {};
@@ -5,9 +5,9 @@ import { Input, ParserOutput } from '../interfaces';
5
5
  export { args };
6
6
  export { flags };
7
7
  export { flagUsages } from './help';
8
- export declare function parse<TFlags, TArgs extends {
8
+ export declare function parse<TFlags, GFlags, TArgs extends {
9
9
  [name: string]: string;
10
- }>(argv: string[], options: Input<TFlags>): Promise<ParserOutput<TFlags, TArgs>>;
10
+ }>(argv: string[], options: Input<TFlags, GFlags>): Promise<ParserOutput<TFlags, GFlags, TArgs>>;
11
11
  declare const boolean: typeof flags.boolean, integer: (opts?: {
12
12
  min?: number | undefined;
13
13
  max?: number | undefined;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // tslint:disable interface-over-type-literal
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.file = exports.directory = exports.url = exports.integer = exports.boolean = exports.parse = exports.flagUsages = exports.flags = exports.args = void 0;
5
4
  const args = require("./args");
@@ -22,7 +21,7 @@ async function parse(argv, options) {
22
21
  '--': options['--'],
23
22
  flags: {
24
23
  color: flags.defaultFlags.color,
25
- ...((options.flags || {})),
24
+ ...options.flags,
26
25
  },
27
26
  strict: options.strict !== false,
28
27
  };
@@ -1,5 +1,5 @@
1
1
  import { ParserInput, ParserOutput } from '../interfaces';
2
2
  export declare function validate(parse: {
3
3
  input: ParserInput;
4
- output: ParserOutput<any, any>;
4
+ output: ParserOutput;
5
5
  }): void;
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.13.1",
4
+ "version": "1.13.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {