Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oclif/core

Package Overview
Dependencies
Maintainers
0
Versions
414
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.0.37 to 4.1.0

4

lib/interfaces/parser.d.ts

@@ -170,2 +170,6 @@ import { Command } from '../command';

noCacheDefault?: boolean;
/**
* At least one of these flags must be provided.
*/
atLeastOne?: string[];
};

@@ -172,0 +176,0 @@ export type ArgProps = {

@@ -67,4 +67,7 @@ "use strict";

if (flag.exactlyOne && flag.exactlyOne.length > 0) {
return [validateAcrossFlags(flag)];
return [validateExactlyOneAcrossFlags(flag)];
}
if (flag.atLeastOne && flag.atLeastOne.length > 0) {
return [validateAtLeastOneAcrossFlags(flag)];
}
return [];

@@ -95,4 +98,4 @@ });

const getPresentFlags = (flags) => Object.keys(flags).filter((key) => key !== undefined);
function validateAcrossFlags(flag) {
const base = { name: flag.name, validationFn: 'validateAcrossFlags' };
function validateExactlyOneAcrossFlags(flag) {
const base = { name: flag.name, validationFn: 'validateExactlyOneAcrossFlags' };
const intersection = Object.entries(parse.input.flags)

@@ -110,2 +113,16 @@ .map((entry) => entry[0]) // array of flag names

}
function validateAtLeastOneAcrossFlags(flag) {
const base = { name: flag.name, validationFn: 'validateAtLeastOneAcrossFlags' };
const intersection = Object.entries(parse.input.flags)
.map((entry) => entry[0]) // array of flag names
.filter((flagName) => parse.output.flags[flagName] !== undefined) // with values
.filter((flagName) => flag.atLeastOne && flag.atLeastOne.includes(flagName)); // and in the atLeastOne list
if (intersection.length === 0) {
// the command's atLeastOne may or may not include itself, so we'll use Set to add + de-dupe
const deduped = (0, util_1.uniq)(flag.atLeastOne?.map((flag) => `--${flag}`) ?? []).join(', ');
const reason = `At least one of the following must be provided: ${deduped}`;
return { ...base, reason, status: 'failed' };
}
return { ...base, status: 'success' };
}
async function validateExclusive(name, flags) {

@@ -112,0 +129,0 @@ const base = { name, validationFn: 'validateExclusive' };

4

package.json
{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "4.0.37",
"version": "4.1.0",
"author": "Salesforce",

@@ -54,3 +54,3 @@ "bugs": "https://github.com/oclif/core/issues",

"eslint-config-oclif": "^5.2.2",
"eslint-config-oclif-typescript": "^3.1.12",
"eslint-config-oclif-typescript": "^3.1.13",
"eslint-config-prettier": "^9.1.0",

@@ -57,0 +57,0 @@ "husky": "^9.1.7",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc