Add support for file category sort
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 510
- PR merge metrics
- No merged PRs in 30d
Description
Enhancement of https://github.com/Peltoche/lsd/pull/413
# The problem
Currently, if you have media files such as `.mkv`, `.mp4`, and `.webm` they won't appear together but instead be spread out.
Same for `.jpg` and `.png` which is pretty annoying.
# Proposed solutions
## Sort by icon
An easy improvement would be to sort on `(icon, extension)` as currently many file types belonging to the same category have the same icon (e.g. `.mp4`, `.mov`, `.mkv`).
## Sort by mime type
An alternative would be to rely on the [mime media types](https://www.iana.org/assignments/media-types/media-types.xhtml) but it's far from perfect:
- Some file types are in several categories, with some that don't make sense.
- e.g. mp4 is `application/mp4`, `audio/mp4`, and `video/mp4`
- The granularity is poor. There are only 10 categories: `application`, `audio`, `font`, `example`, `image`, `message`, `model`, `multipart`, `text`, and `video`.
## Sort by custom category definitions
A better improvement would be to embed a simple hierarchical category system, where formats are put in the category that makes the most sense. The ordering would be on the key `(category, extension)`.
For example it could look like that:
```yaml
video:
compression: [h264, h265]
container: [avi, mp4, mkv]
audio:
compression: [aac, opus, mp3, wma]
container: [ogg, wav]
text:
plain: [txt, log]
formatted: [md]
code:
system: [c, cpp, go]
web: [html, js, css]
script: [py, sh]
```
Etc.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing pull request #413 and the existing file-sorting implementation. Before coding, resolve whether sorting should use icons, MIME types, or custom hierarchical categories; done means the chosen category scheme groups related extensions consistently and defines their ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100