MCPcopy
hub / github.com/shelljs/shelljs / _dirs

Function _dirs

src/dirs.js:173–209  ·  view source on GitHub ↗
(options, index)

Source from the content-addressed store, hash-verified

171//@
172//@ See also: `pushd`, `popd`
173function _dirs(options, index) {
174 if (_isStackIndex(options)) {
175 index = options;
176 options = '';
177 }
178
179 options = common.parseOptions(options, {
180 'c': 'clear',
181 'q': 'quiet',
182 });
183
184 if (options.clear) {
185 _dirStack = [];
186 return _dirStack;
187 }
188
189 var stack = _actualDirStack();
190
191 if (index) {
192 index = _parseStackIndex(index);
193
194 if (index < 0) {
195 index = stack.length + index;
196 }
197
198 if (!options.quiet) {
199 common.log(stack[index]);
200 }
201 return stack[index];
202 }
203
204 if (!options.quiet) {
205 common.log(stack.join(' '));
206 }
207
208 return stack;
209}
210exports.dirs = _dirs;

Callers 2

_pushdFunction · 0.85
_popdFunction · 0.85

Calls 3

_isStackIndexFunction · 0.85
_actualDirStackFunction · 0.85
_parseStackIndexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…