lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Permissions in rwx in one column and octal in another

Open andrewcrook opened this issue 3 years ago • 3 comments

Problem

Some times it is nice to have permissions in rwx in one column and octal in another

Current options (config file)

# == Permission ==
# Specify the format of the permission column
# Possible value: rwx, octal
permission: rwx

Proposed Solutions

Solution 1

An option to show both rwx and octal call this both This will be one column position or block “permissions" However, split into two columns for the two sets of data when both is selected Therefore, these two columns will always be consecutive.

# == Permission ==
# Specify the format of the permission column
# Possible value: rwx, octal, both
permission: both 

Solution 2

Have two separate blocks types These are “permission" and “octal” the current configuration for the permission block would no longer be required Advantage is the “permission" and “octal” columns do not have to be consecutive.

# == Blocks ==
# This specifies the columns and their order when using the long and the tree
# layout.
# Possible values: permission, user, group, size, size_value, date, name, inode
 blocks:
   - permission
   - octal
   - user
   - group
   - size
   - date
   - name

# ------ no longer required  --------
# == Permission ==
# Specify the format of the permission column
# Possible value: rwx, octal
# permission: rwx

### equivalent example

>> gstat -c '%A %a %n’ ~
drwxr-x--- 750 /Users/andrew

andrewcrook avatar Sep 05 '22 15:09 andrewcrook

It seems pretty duplicated, why would it be useful?

zwpaper avatar Sep 06 '22 02:09 zwpaper

A thought I previously had was being able to add options at the end of different blocks using : as separator, in this case the command would be something like:

lsd --blocks permissions:octal,permissions:rwx

This would prevent us from having to implement more flags for how to deal with these, plus will be more customizable with the placement of different options.

I'm still not sure if this is a useful feature, just wanted to add a suggestion on how we can possibly do it if we decide to.

meain avatar Sep 10 '22 06:09 meain

Came across this to see if it was possible - I'm trying to decide between eza (which can do this) and this (which currently can't, which is a bummer, because in a number of ways, I prefer this!)

It seems pretty duplicated, why would it be useful?

My real-world use-case for this feature request: While I'm reading the permissions from a listing, rwx is easier to parse, (ie, it's more human-readable) but when I'm applying permissions, octal is sometimes required (eg when packaging apps and using install -m). In the past, this exact situation (reading file perms from a live filesystem and applying them to an RPM package) has required me to visit an octal-rwx calculator website (yes, I could just do it in my head, a few bits isn't that hard, but I'm ~~lazy~~ efficient, and computers are faster, and most importantly, don't make mistakes when they are tired from staying up late programming... I'm typing this at 0445 in the morning.... We've all been there, right? :laughing: )

So are there other ways to deal with this problem? Absolutely. Are they as cool as this FR? Definitely not.

I'm still not sure if this is a useful feature, just wanted to add a suggestion on how we can possibly do it if we decide to.

Please do decide to. It's definitely useful.

Edit: Fixing typos because it's 0453 and humans make errors when they stay up late programming...See? Useful! :rofl:

pallaswept avatar Feb 17 '24 17:02 pallaswept