shelljs icon indicating copy to clipboard operation
shelljs copied to clipboard

Feature request (ls): format file mode (permission) in base 8

Open nfischer opened this issue 4 years ago • 2 comments

I noticed that shx ls -l prints the file permission in base 10 (decimal). This is difficult to understand since this is represented more naturally in base 8 (octal). The ShellJS API (shell.ls('-l')) actually returns a structured object, however it includes a toString() implementation on the object as well:

https://github.com/shelljs/shelljs/blob/ad911973cdbe1a6f5f3192d215c78ce3a9060492/src/ls.js#L136-L139

Most folks relying on shell.ls('-l') are probably using the structured object rather than its stringified version. The stringified version is mostly relevant for https://github.com/shelljs/shx and https://github.com/nfischer/n_shell.

nfischer avatar Jan 06 '22 03:01 nfischer

We could also consider converting this into the -rw-rw-r-- format instead of octal, but that's a bit more work.


Other discrepancies I noticed:

  • shx ls -l prints a UID (as an integer) instead of the username/groupname
  • shx ls -l outputs timestamps in the format Wed Jan 05 2022 19:05:48 GMT-0800 (Pacific Standard Time) as opposed to the more succinct Jan 5 19:05

nfischer avatar Jan 06 '22 03:01 nfischer