Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add file permissions and owner to "info" option #1554

Closed
owallb opened this issue Dec 19, 2023 · 6 comments · Fixed by #1799
Closed

Feature request: Add file permissions and owner to "info" option #1554

owallb opened this issue Dec 19, 2023 · 6 comments · Fixed by #1799

Comments

@owallb
Copy link
Contributor

owallb commented Dec 19, 2023

Allow setting permissions (mode) and user/group owner to the info option, similar to what is possible in promptfmt.

As an example to illustrate what I'm requesting, imagine this was set in lfrc:

set info mode:user:group:size:time

Which would then give:
image

owallb added a commit to owallb/lf that referenced this issue Sep 13, 2024
@owallb
Copy link
Contributor Author

owallb commented Sep 13, 2024

I have prepared changes to support this, let me know if the project is interested in having it implemented and I will open a PR.

@joelim-work
Copy link
Collaborator

Hi, I think permission should be straightforward to implement.

But for user/group, this is a bit tricky because if there are different values then it could cause the fields to not align properly. In your example, it works conveniently because the value is always oscar, but that is not always going to be the case for other people. So you will either have to:

  • Hardcode the width of the user/group fields to something like 8 characters
  • Introduce another configuration option to control this (though IMO it does feel too specific to justify adding such an option)

@owallb
Copy link
Contributor Author

owallb commented Sep 13, 2024

That's a good point I hadn't considered, I'll see if I can come up with something.

@joelim-work
Copy link
Collaborator

Also I took a very quick look at your fork, you should make documentation changes to doc.md, not doc.txt. It is mentioned somewhat indirectly in CONTRIBUTING.md, hopefully that should help.

@owallb
Copy link
Contributor Author

owallb commented Sep 13, 2024

Fixed, thanks.

Once solution to the width issue I could think of is to calculate the maximum of user/group before iterating dir.files in printDir().

Using a forced width of ~8 is cleaner to implement but less flexible. I've added the aforementioned approach but I would understand if you prefer using a constant width. I think most people use short names most of the time, anyway.

@joelim-work
Copy link
Collaborator

OK, I forgot about the possibility of just doing a second pass to obtain the max user/group widths - that should work too and is probably better than using a hardcoded width.

I think this feature is worth including - if you submit it as a PR I will review it in more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants