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

eshost-cli

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eshost-cli - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

37

bin/eshost.js

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

eshost --list
eshost --add [host name] [host type] <host path> <host arguments>
eshost --add [host name] [host type] <host path> --args <host arguments>
eshost --delete [host name]

@@ -27,5 +27,7 @@ `.trim();

.usage(usage)
.describe('e', 'eval a string')
.describe('e', 'eval an expression and print the result')
.alias('e', 'eval')
.describe('h', 'select hosts by name')
.describe('x', 'execute a multi-statement program')
.alias('x', 'execute')
.describe('h', 'select hosts by name (glob syntax is supported as well)')
.alias('h', 'host')

@@ -56,3 +58,3 @@ .describe('g', 'select host groups by host type')

.nargs('delete', 1)
.describe('args', 'set arguments for a host entry')
.describe('args', 'set arguments for a host entry (use with --add)')
.nargs('args', 1)

@@ -64,2 +66,3 @@ .help('help')

.example('eshost -e "1+1"')
.example('eshost -its -x "for (let i=0; i<10; ++i) { print(i) }"')
.example('eshost -h d8 -h chakra test.js')

@@ -69,2 +72,4 @@ .example('eshost -h d8,sm test.js')

.example('eshost -h d8 -g node test.js')
.example('eshost -h ch-*,node test.js')
.example('eshost -h ch-1.?.? test.js')
.fail(function (msg, err) {

@@ -95,2 +100,23 @@ if (err) {

// Add host glob matches to hosts
let newHosts = [];
for (let host of hosts) {
if (host.indexOf('*') >= 0 || host.indexOf('?') >= 0) {
let re = '^' + host
.replace(/\./g, '\\.') // escape . with /\./
.replace(/\*/g, '.*') // change * to /.*/ for matches
.replace(/\?/g, '.') // change ? to /./ for matches
+ '$';
let matcher = new RegExp(re);
for (let hostName of Object.keys(config.hosts)) {
if (matcher.test(hostName)) {
newHosts.push(hostName);
}
}
} else {
newHosts.push(host);
}
hosts = newHosts;
}
let hostGroups;

@@ -160,3 +186,2 @@ if (Array.isArray(argv.g)) {

const file = argv._[0];
const evalString = argv.e;

@@ -170,2 +195,4 @@ process.stdin.setEncoding('utf8');

runInEachHost(`print(${argv.e})`, hosts);
} else if (argv.x) {
runInEachHost(argv.x, hosts);
} else {

@@ -172,0 +199,0 @@ let script = '';

2

lib/host-manager.js

@@ -35,3 +35,3 @@ 'use strict';

chalk.red(
`Host '${type}' not supported. Supported hosts are: ${esh.supportedHosts.join(', ')}`
`Host type '${type}' not supported. Supported host types are: ${esh.supportedHosts.join(', ')}`
)

@@ -38,0 +38,0 @@ );

@@ -0,0 +0,0 @@ module.exports = class Reporter {

@@ -0,0 +0,0 @@ const Reporter = require('../Reporter.js');

@@ -0,0 +0,0 @@ const Reporter = require('../Reporter.js');

{
"name": "eshost-cli",
"version": "3.2.0",
"version": "3.3.0",
"description": "Run scripts in any ECMAScript host",

@@ -5,0 +5,0 @@ "bin": {

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