зеркало из https://github.com/microsoft/shelljs.git
Added semicolons and removed dirs from exports
This commit is contained in:
Родитель
4bc3725137
Коммит
18a10bb3d9
7
shell.js
7
shell.js
|
@ -867,7 +867,7 @@ var _dirStack = (function(stack) {
|
|||
if (isNaN(index)) {
|
||||
return /^[-+]\d+$/.test(index);
|
||||
} else {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
}.bind(stack)
|
||||
|
||||
|
@ -889,7 +889,6 @@ var _dirStack = (function(stack) {
|
|||
function _dirs(options) {
|
||||
return ShellString(_dirStack.join(' ') || process.cwd());
|
||||
}
|
||||
exports.dirs = wrap('dirs', _dirs)
|
||||
|
||||
//@
|
||||
//@ ### pushd(['-n'], [dir | '-N' | '+N'])
|
||||
|
@ -929,7 +928,7 @@ function _pushd(options, dir) {
|
|||
exports.cd(_dirStack[0]);
|
||||
}
|
||||
|
||||
return exports.dirs();
|
||||
return _dirs();
|
||||
};
|
||||
exports.pushd = wrap('pushd', _pushd);
|
||||
|
||||
|
@ -970,7 +969,7 @@ function _popd(options, index) {
|
|||
error('directory stack empty')
|
||||
}
|
||||
|
||||
return exports.dirs();
|
||||
return _dirs();
|
||||
};
|
||||
exports.popd = wrap("popd", _popd);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ fs.existsSync = fs.existsSync || path.existsSync;
|
|||
|
||||
shell.config.silent = false;
|
||||
|
||||
var root = path.resolve(), trail
|
||||
var root = path.resolve(), trail;
|
||||
|
||||
// Pushing to valid directories
|
||||
shell.pushd('resources/pushd');
|
||||
|
@ -48,4 +48,4 @@ assert.equal(trail.length, 2);
|
|||
assert.equal(trail[0], path.resolve(root, 'resources/pushd'));
|
||||
assert.equal(trail[1], root);
|
||||
|
||||
shell.exit(123)
|
||||
shell.exit(123);
|
|
@ -9,37 +9,37 @@ fs.existsSync = fs.existsSync || path.existsSync;
|
|||
|
||||
shell.config.silent = false;
|
||||
|
||||
var root = path.resolve(), trail
|
||||
var root = path.resolve(), trail;
|
||||
|
||||
// Pushing to valid directories
|
||||
trail = shell.pushd('resources/pushd').split(' ');
|
||||
assert.equal(shell.error(), null)
|
||||
assert.equal(trail.length, 2)
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd')
|
||||
assert.equal(trail[1], root)
|
||||
assert.equal(shell.error(), null);
|
||||
assert.equal(trail.length, 2);
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd');
|
||||
assert.equal(trail[1], root);
|
||||
|
||||
trail = shell.pushd('a').split(' ')
|
||||
assert.equal(shell.error(), null)
|
||||
assert.equal(trail.length, 3)
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/a')
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd')
|
||||
assert.equal(trail[2], root)
|
||||
trail = shell.pushd('a').split(' ');
|
||||
assert.equal(shell.error(), null);
|
||||
assert.equal(trail.length, 3);
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/a');
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd');
|
||||
assert.equal(trail[2], root);
|
||||
|
||||
trail = shell.pushd('../b').split(' ')
|
||||
assert.equal(shell.error(), null)
|
||||
assert.equal(trail.length, 4)
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/b')
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd/a')
|
||||
assert.equal(path.relative(root, trail[2]), 'resources/pushd')
|
||||
assert.equal(trail[3], root)
|
||||
trail = shell.pushd('../b').split(' ');
|
||||
assert.equal(shell.error(), null);
|
||||
assert.equal(trail.length, 4);
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/b');
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd/a');
|
||||
assert.equal(path.relative(root, trail[2]), 'resources/pushd');
|
||||
assert.equal(trail[3], root);
|
||||
|
||||
trail = shell.pushd('c').split(' ')
|
||||
assert.equal(shell.error(), null)
|
||||
assert.equal(trail.length, 5)
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/b/c')
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd/b')
|
||||
assert.equal(path.relative(root, trail[2]), 'resources/pushd/a')
|
||||
assert.equal(path.relative(root, trail[3]), 'resources/pushd')
|
||||
assert.equal(trail[4], root)
|
||||
trail = shell.pushd('c').split(' ');
|
||||
assert.equal(shell.error(), null);
|
||||
assert.equal(trail.length, 5);
|
||||
assert.equal(path.relative(root, trail[0]), 'resources/pushd/b/c');
|
||||
assert.equal(path.relative(root, trail[1]), 'resources/pushd/b');
|
||||
assert.equal(path.relative(root, trail[2]), 'resources/pushd/a');
|
||||
assert.equal(path.relative(root, trail[3]), 'resources/pushd');
|
||||
assert.equal(trail[4], root);
|
||||
|
||||
shell.exit(123)
|
||||
shell.exit(123);
|
Загрузка…
Ссылка в новой задаче