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

opt-cli

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opt-cli - npm Package Compare versions

Comparing version 1.5.2 to 1.6.0

2

.eslintrc.json

@@ -5,3 +5,3 @@ {

"max-len": [ 0 ],
"max-statements": [ 2, { "maximum": 16 }, { "ignoreTopLevelFunctions": true } ],
"max-statements": [ 2, { "maximum": 20 }, { "ignoreTopLevelFunctions": true } ],
"no-process-env": [ 0 ],

@@ -8,0 +8,0 @@ "require-jsdoc": [ 0 ]

@@ -19,2 +19,3 @@ #!/usr/bin/env node

.option( '-e, --exec <command>', 'Command to execute when opted-in to or not opted-out of the given rule' )
.option( '-l, --list', 'List explicitly set opt-in and opt-out rules' )
.option( '--verbose', 'Output additional details' );

@@ -53,4 +54,7 @@

// invalid arguments: "in" OR "out" have to be specified, as well es "exec"
if ( ( program.in && program.out ) || ( !program.in && !program.out ) || !program.exec ) {
// invalid arguments: ("in" OR "out" have to be specified, as well es "exec") OR "list" has to be requested
if (
( ( program.in && program.out ) || ( !program.in && !program.out ) || !program.exec ) &&
!program.list
) {
program.help();

@@ -77,2 +81,8 @@

if ( program.list ) {
listExplicitOpts();
return;
}
// prepare PATH env var to include cwd/node_modules/bin

@@ -86,1 +96,33 @@ alteredEnvPath = managePath( env );

}
function listExplicitOpts() {
var explictOpts = opt.getExplicitOpts(),
flags = Object.keys( explictOpts ), // eslint-disable-line id-match
sorted = { in: [], out: [] },
output = [];
// Filter results to print in-out
sorted = flags.reduce(
function sortExplicit( accumulator, key ) {
accumulator[ explictOpts[ key ] ? 'in' : 'out' ].push( key );
return accumulator;
},
sorted
);
if ( sorted.in.length ) {
output.push( 'Opted-in to:\n' + ' - ' + sorted.in.join( '\n - ' ) );
}
if ( sorted.out.length ) {
output.push( 'Opted-out of:\n' + ' - ' + sorted.out.join( '\n - ' ) );
}
if ( !flags.length ) {
output.push( 'No explict opt-in or opt-out configuration found.' );
}
// eslint-disable-next-line no-console
console.log( output.join( '\n\n' ) );
}
{
"name": "opt-cli",
"version": "1.5.2",
"version": "1.6.0",
"description": "Execute CLI Statements based upon Opt-In / Opt-Out Rules.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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