Comparing version 0.1.22 to 0.1.23
@@ -41,5 +41,22 @@ var fs = require('fs'), | ||
if (fs.existsSync(u)) { | ||
fs.readdirSync(u).forEach(function (v) { | ||
try { | ||
fs.readdirSync(u).forEach(function (v) { | ||
try { | ||
var stats = fs.statSync(path.join(u, v)), | ||
mode = stats.mode.toString(8); | ||
mode = +mode[mode.length - 1]; | ||
var isExecutable = mode % 2 === 1; | ||
if (isExecutable && RegExp('^' + escapeRegExp(broken.last)).test(v)) { | ||
possibilities.executables.push(v); | ||
} | ||
} catch (e) {} | ||
}); | ||
} catch (e) {} | ||
} | ||
}); | ||
else if (fs.existsSync(broken.lastPath)) { | ||
try { | ||
fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
try { | ||
var stats = fs.statSync(path.join(u, v)), | ||
var stats = fs.statSync(path.join(broken.lastPath, v)), | ||
mode = stats.mode.toString(8); | ||
@@ -53,15 +70,4 @@ mode = +mode[mode.length - 1]; | ||
}); | ||
} | ||
}); | ||
else if (fs.existsSync(broken.lastPath)) fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
try { | ||
var stats = fs.statSync(path.join(broken.lastPath, v)), | ||
mode = stats.mode.toString(8); | ||
mode = +mode[mode.length - 1]; | ||
var isExecutable = mode % 2 === 1; | ||
if (isExecutable && RegExp('^' + escapeRegExp(broken.last)).test(v)) { | ||
possibilities.executables.push(v); | ||
} | ||
} catch (e) {} | ||
}); | ||
} | ||
var js = extractPureJs(cmd); | ||
@@ -94,16 +100,18 @@ try { | ||
if (fs.existsSync(broken.lastPath)) { | ||
fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
if (re.test(v)) { | ||
try { | ||
var stats = fs.statSync(path.join(broken.lastPath, v)), | ||
mode = stats.mode.toString(8); | ||
mode = +mode[mode.length - 1]; | ||
var isExecutable = mode % 2 === 1; | ||
if (stats.isDirectory()) possibilities.directories.push(v); | ||
else if (isExecutable) { | ||
possibilities.executables.push(v); | ||
} else possibilities.files.push(v); | ||
} catch (e) {} | ||
} | ||
}); | ||
try { | ||
fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
if (re.test(v)) { | ||
try { | ||
var stats = fs.statSync(path.join(broken.lastPath, v)), | ||
mode = stats.mode.toString(8); | ||
mode = +mode[mode.length - 1]; | ||
var isExecutable = mode % 2 === 1; | ||
if (stats.isDirectory()) possibilities.directories.push(v); | ||
else if (isExecutable) { | ||
possibilities.executables.push(v); | ||
} else possibilities.files.push(v); | ||
} catch (e) {} | ||
} | ||
}); | ||
} catch (e) {} | ||
} | ||
@@ -110,0 +118,0 @@ printPossibles(possibilities); |
@@ -29,10 +29,12 @@ var fs = require('fs'), | ||
if (fs.existsSync(broken.lastPath)) { | ||
fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
if (re.test(v)) { | ||
try { | ||
stats = fs.statSync(path.join(broken.lastPath, v)); | ||
if (stats.isDirectory()) ret.directories.push(v); | ||
} catch (e) {} | ||
} | ||
}); | ||
try { | ||
fs.readdirSync(broken.lastPath).forEach(function (v) { | ||
if (re.test(v)) { | ||
try { | ||
stats = fs.statSync(path.join(broken.lastPath, v)); | ||
if (stats.isDirectory()) ret.directories.push(v); | ||
} catch (e) {} | ||
} | ||
}); | ||
} catch (e) {} | ||
} | ||
@@ -39,0 +41,0 @@ return ret; |
@@ -5,8 +5,8 @@ var escapeRegExp = require('./escape-regexp'); | ||
while (obj) { | ||
ret.push(Object.keys(obj).filter(function (v) { | ||
ret.push(Object.getOwnPropertyNames(obj).filter(function (v) { | ||
return RegExp('^' + escapeRegExp(startsWith)).test(v); | ||
})); | ||
obj = obj.__proto__; | ||
obj = Object.getPrototypeOf(obj); | ||
} | ||
return ret; | ||
} |
@@ -94,18 +94,17 @@ var times = require('./string-multiply'), | ||
if (first) { | ||
if (breakBeforeJs) write('\n'); | ||
} else write('\n'); | ||
if (breakBeforeJs) write('\n\n'); | ||
} else write('\n\n'); | ||
first = false; | ||
while (possibles.js[0][0]) { | ||
max = Math.max(width - possibles.js[0][0].length, 2); | ||
if (max + possibles.js[0][0].length + 1 + cursor > process.stdout.columns) { | ||
write('\n'); | ||
cursor = 0; | ||
} | ||
write(possibles.js[0][0] + times(' ', max)); | ||
cursor += possibles.js[0][0].length + max; | ||
possibles.js[0].splice(0, 1); | ||
} | ||
} | ||
first = false; | ||
while (possibles.js[0][0]) { | ||
max = Math.max(width - possibles.js[0][0].length, 2); | ||
if (max + possibles.js[0][0].length + 1 + cursor > process.stdout.columns) { | ||
write('\n'); | ||
cursor = 0; | ||
} | ||
write(possibles.js[0][0] + times(' ', max)); | ||
cursor += possibles.js[0][0].length + max; | ||
possibles.js[0].splice(0, 1); | ||
} | ||
possibles.js.splice(0, 1); | ||
if (possibles.js[0]) write('\n'); | ||
} | ||
@@ -112,0 +111,0 @@ if (println) write('\n'); |
{ | ||
"name": "jsh", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"description": "The JavaScript shell interpreter.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -52,3 +52,3 @@ # jsh - The JavaScript Shell | ||
4. --coffee flag for CoffeeScript mode | ||
5. Backtick substitution, e.g. var files = `ls`.split('\n') | ||
5. Backtick substitution, e.g. var files = \`ls\`.split('\n') | ||
@@ -55,0 +55,0 @@ ### Known Bugs |
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
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
133909
2496