Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Ability to see more info about folders or files in default view. #63

Closed
thepenguinthatwants opened this issue Jan 16, 2019 · 6 comments
Closed
Labels
enhancement New feature or request

Comments

@thepenguinthatwants
Copy link

Right now its only one click away (x) but I am wondering if in the default view we can customize fff to show more info.. like an auto-updating info about file size like in nnn? Or seeing the rights of the file.

@dylanaraps dylanaraps added the enhancement New feature or request label Jan 16, 2019
@Frago9876543210
Copy link

It would be nice to show the size of files, etc.

@dylanaraps
Copy link
Owner

There's no method of grabbing file size in pure bash (bash is aware of file size internally, however scripts can't access this information). As for file permissions, scripts can partially grab the information (file permissions can be retrieved for current user only).

See this example script (usage: script path):

#!/usr/bin/env bash
#
# Show file perms in pure bash.

file="${1:-${HOME}/dotfiles}"

[[ -r $file ]] && r="r"
[[ -w $file ]] && w="w"
[[ -x $file ]] && x="x"

printf '%s\n' "$file: ${r:--}${w:--}${x--}"

Example output:

➜ perms /
/: r-x
➜ perms ~
/home/black: rwx
➜ perms /usr/share/alsa/
/usr/share/alsa/: r-x

Would this permissions output suffice? The idea is to show it in the status_line for the current file (to not clutter the file list).

@Frago9876543210
Copy link

Size can be obtained through du -sh file

@dylanaraps
Copy link
Owner

I'm aware. I'm referring to a pure bash method of retrieving the information. Using du -sh on every file in the list would noticeably slow fff down. The -h flag is also non-POSIX which would require fff to convert the size to a human readable format every-time an item line is printed.

I have this working locally and the delay both visually and latency-wise is too large to make this feature worthwhile. I've optimized the du call to once per directory read. The only issue is optimizing the print_line function since accessing the file information (which is stored in an array with a matching index) is rather slow.

@dylanaraps
Copy link
Owner

I have file size working in this PR: #95

Try it out and let me know how it works for you.

Note: File size conversion from bytes is currently lazy. I'm sill working on full conversion.

@dylanaraps
Copy link
Owner

I've changed my mind and this won't be added. fff will stay as minimal as possible due to time constraints in my life. This may be revisited at some point. #95 will stay open.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants