Socket
Socket
Sign inDemoInstall

shelljs-plugin-open

Package Overview
Dependencies
26
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

22

index.js

@@ -5,4 +5,4 @@ // This exposes the plugin utilities

// Require whatever modules you need for your project
var child = require('child_process');
var fs = require('fs');
var opener = require('opener');
var pathExists = require('path-exists');

@@ -14,15 +14,11 @@ // Implement your command in a function, which accepts `options` as the

if (!fs.existsSync(fileName) && !fileName.match(URL_REGEX)) {
if (!pathExists.sync(fileName) && !fileName.match(URL_REGEX)) {
plugin.error('Unable to locate file: ' + fileName);
}
var cmd;
if (process.platform.match(/^win/))
cmd = 'start';
else if (process.platform.match(/^linux/))
cmd = 'xdg-open';
else // assume it's Mac OS X, which uses `open`
cmd = 'open';
child.exec(cmd + ' ' + JSON.stringify(fileName));
var proc = opener(fileName);
proc.unref();
proc.stdin.unref();
proc.stdout.unref();
proc.stderr.unref();
return '';

@@ -33,5 +29,3 @@ }

plugin.register('open', open, {
globStart: 1, // Start globbing at the first non-option argument
cmdOptions: {}, // There are no supported options for this command
wrapOutput: true, // Wrap the output in a ShellString
});

@@ -38,0 +32,0 @@

{
"name": "shelljs-plugin-open",
"version": "0.1.1",
"version": "0.1.2",
"description": "An example shelljs-plugin to open a file with its default application",

@@ -41,3 +41,7 @@ "main": "index.js",

"shelljs": "^0.7.3"
},
"dependencies": {
"opener": "^1.4.1",
"path-exists": "^3.0.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc