shelljs / shelljs/shelljs

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

Open
#1,059 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bash compat feature low priority
Dominant language
JavaScript
Stars
14.4k
Forks
756
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/ls.js at the toString() implementation linked in the issue, and compare its output with shx ls -l. Update the stringified file-mode formatting to use base 8 while preserving the structured shell.ls('-l') object, then verify the resulting command output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, shell
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.