diff --git a/shell.js b/shell.js index b8f4d9a..5822844 100644 --- a/shell.js +++ b/shell.js @@ -530,8 +530,13 @@ function _test(options, path) { // hack - only works with unary primaries options = parseOptions(options, { + 'b': 'block', + 'c': 'character', 'd': 'directory', - 'f': 'file' + 'f': 'file', + 'L': 'link', + 'p': 'pipe', + 'S': 'socket' }); var canInterpret = false; @@ -549,11 +554,26 @@ function _test(options, path) { stats = fs.lstatSync(path); + if (options.block) + return stats.isBlockDevice(); + + if (options.character) + return stats.isCharacterDevice(); + if (options.directory) return stats.isDirectory(); if (options.file) return stats.isFile(); + + if (options.link) + return stats.isSymbolicLink(); + + if (options.pipe) + return stats.isFIFO(); + + if (options.socket) + return stats.isSocket() }; // test exports.test = wrap('test', _test);