🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@oclif/core

Package Overview
Dependencies
Maintainers
2
Versions
471
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version
4.11.14
to
4.12.0
+18
-0
lib/args.d.ts

@@ -39,1 +39,19 @@ import { URL } from 'node:url';

export { stringArg as string };
type ReadonlyElementOf<T extends ReadonlyArray<unknown>> = T[number];
/**
* Create an arg that infers the type from the provided options.
*
* The provided `options` must be a readonly array in order for type inference to work.
*
* @example
* export default class MyCommand extends Command {
* static args = {
* stage: Args.option({
* options: ['production', 'staging', 'development'] as const,
* })(),
* }
* }
*/
export declare function option<T extends readonly string[]>(defaults: Omit<Partial<Arg<ReadonlyElementOf<T>>>, 'default' | 'multiple' | 'required'> & {
options: T;
}): ArgDefinition<(typeof defaults.options)[number]>;

@@ -5,2 +5,3 @@ "use strict";

exports.custom = custom;
exports.option = option;
const node_url_1 = require("node:url");

@@ -63,1 +64,24 @@ const fs_1 = require("./util/fs");

exports.string = stringArg;
/**
* Create an arg that infers the type from the provided options.
*
* The provided `options` must be a readonly array in order for type inference to work.
*
* @example
* export default class MyCommand extends Command {
* static args = {
* stage: Args.option({
* options: ['production', 'staging', 'development'] as const,
* })(),
* }
* }
*/
function option(defaults) {
return (options = {}) => ({
parse: async (i, _context, _opts) => i,
...defaults,
...options,
input: [],
type: 'option',
});
}
+2
-2

@@ -201,3 +201,3 @@ import { Command } from '../command';

multiple?: boolean;
options?: string[];
options?: readonly string[];
ignoreStdin?: boolean;

@@ -248,3 +248,3 @@ /**

export type Arg<T, P = CustomOptions> = ArgProps & {
options?: T[];
options?: readonly T[];
defaultHelp?: ArgDefaultHelp<T>;

@@ -251,0 +251,0 @@ input: string[];

{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "4.11.14",
"version": "4.12.0",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues",