Conversation
|
@gvn @ariporad this should be ready for review. I believe Windows does not support Here's a comparison of output from The dates are javascript dates. The uid and gid are ID numbers, not username/groupname (this npm module uses C code to translate ID to name). The modes are in whatever representation |
src/ls.js
Outdated
There was a problem hiding this comment.
I'd suggest making this value just the filename instead of the entire path, and then adding another property called path with the full path. Seems a little clearer that way IMO.
There was a problem hiding this comment.
I see the benefit, but it could be slightly trickier that way. ls -l returns output with the relative path to the file, so that's what I'm opting for with this. If users need the specific name, they can use path.basename() to get it. If they need the full path, I think path.resolve() would do it.
I could use these functions to set the internal properties, but it's harder to use the full path and basename to get the relative path for the toString() method.
There was a problem hiding this comment.
Ah, I see. In that case path or relativePath would be more semantic than name, but only a by a little bit, so close enough! 😉
|
I had a couple thoughts, but otherwise this looks great! I tested on OS X w Node v5.4.1 Thanks for jumping on this so quickly. 👍 PS: Great idea with the |
There was a problem hiding this comment.
I forgot to add docs for the -d option, so I'm adding them now.
|
@nfischer: One small comment, then looks good. |
The `-l` option will now cause `ls()` to return an object containing file stats. These objects will also have a toString() method that formats it into something analogous to `ls -l`'s output format.
|
LGTM! |
|
This is working great. Thank you @nfischer ! |
|
👍 My pleasure |
The
-loption will now causels()to return an object containing file stats.These objects will also have a toString() method that formats it into something
analogous to
ls -l's output format.This is useful in the case of
ls('-l', 'dir/').join('\n'), which will now have formatting similar to unix'sls -l.The mechanics for
-lare based off #137. This resolves feature request #323.