Comparing version 0.0.3 to 0.1.0
@@ -19,3 +19,20 @@ 'use strict'; | ||
require('./../dist/commands/' + command)(vorpal); | ||
vorpal.exec(command + ' ' + args.join(' ')); | ||
args = args.join(' '); | ||
// If we passed in a help request, load in | ||
// the help file. | ||
if (args.indexOf('help') > -1 || args.indexOf('?') > -1) { | ||
let help; | ||
try { | ||
help = require('./../dist/help/' + command + '.js'); | ||
help = String(help).replace(/^\n|\n$/g, ''); | ||
} catch (e) {} | ||
let cmdObj = vorpal.find(command); | ||
if (cmdObj && help) { | ||
cmdObj.help(function (argus, cb) { | ||
cb(help); | ||
}) | ||
} | ||
} | ||
vorpal.exec(command + ' ' + args); | ||
} else { | ||
@@ -22,0 +39,0 @@ // If we get into piping other commands, |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var path = require('path'); | ||
var os = require('os'); | ||
@@ -89,2 +90,3 @@ var expand = require('./../util/expand'); | ||
} catch (e) { | ||
/* istanbul ignore if */ | ||
if (e.code !== 'EEXIST') { | ||
@@ -102,3 +104,5 @@ throw new Error(); | ||
var iDest = dest; | ||
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) iDest = path.normalize(dest + '/' + path.basename(src)); | ||
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) { | ||
iDest = path.normalize(dest + '/' + path.basename(src)); | ||
} | ||
@@ -116,3 +120,6 @@ if (fs.existsSync(iDest) && options.no_force) { | ||
var self = this; | ||
if (!options) options = {}; | ||
/* istanbul ignore if */ | ||
if (!options) { | ||
options = {}; | ||
} | ||
var checkDir = fs.statSync(sourceDir); | ||
@@ -122,8 +129,11 @@ try { | ||
} catch (e) { | ||
if (e.code !== 'EEXIST') throw e; | ||
/* istanbul ignore if */ | ||
if (e.code !== 'EEXIST') { | ||
throw e; | ||
} | ||
} | ||
var files = fs.readdirSync(sourceDir); | ||
for (var i = 0; i < files.length; i++) { | ||
var srcFile = sourceDir + "/" + files[i]; | ||
var destFile = destDir + "/" + files[i]; | ||
var srcFile = sourceDir + '/' + files[i]; | ||
var destFile = destDir + '/' + files[i]; | ||
var srcFileStat = fs.lstatSync(srcFile); | ||
@@ -135,6 +145,5 @@ if (srcFileStat.isDirectory()) { | ||
var symlinkFull = fs.readlinkSync(srcFile); | ||
fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null); | ||
} else { | ||
fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null); | ||
// At this point, we've hit a file actually worth copying... so copy it on over. | ||
if (fs.existsSync(destFile) && options.noclobber) { | ||
} else if (fs.existsSync(destFile) && options.noclobber) { | ||
// be silent | ||
@@ -144,3 +153,2 @@ } else { | ||
} | ||
} | ||
} | ||
@@ -150,2 +158,3 @@ } | ||
function copyFileSync(src, dest) { | ||
/* istanbul ignore if */ | ||
if (!fs.existsSync(src)) { | ||
@@ -166,3 +175,5 @@ this.log('cp: cannot stat ' + src + ': No such file or directory'); | ||
} catch (e) { | ||
/* istanbul ignore next */ | ||
this.log('cp: cannot open ' + src + ': ' + e.code); | ||
/* istanbul ignore next */ | ||
return; | ||
@@ -174,3 +185,5 @@ } | ||
} catch (e) { | ||
/* istanbul ignore next */ | ||
this.log('cp: cannot write to destination file ' + dest + ': ' + e.code); | ||
/* istanbul ignore next */ | ||
return; | ||
@@ -177,0 +190,0 @@ } |
{ | ||
"name": "cash-cp", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "Cross-platform implementation of the Unix 'cp' command.", | ||
@@ -41,3 +41,3 @@ "main": "./dist/commands/cp.js", | ||
"glob": "^6.0.4", | ||
"vorpal": "^1.9.2" | ||
"vorpal": "^1.9.5" | ||
}, | ||
@@ -44,0 +44,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12287
295
4
Updatedvorpal@^1.9.5