Skip to content

Add --add-filetypes argument#197

Open
ltrzesniewski wants to merge 2 commits into
sharkdp:masterfrom
ltrzesniewski:add-filetypes
Open

Add --add-filetypes argument#197
ltrzesniewski wants to merge 2 commits into
sharkdp:masterfrom
ltrzesniewski:add-filetypes

Conversation

@ltrzesniewski

Copy link
Copy Markdown

This adds an --add-filetypes command line argument which lets you add your own mappings to the database. It can be used multiple times.

The main benefit is to be able to reuse the default database if you just want to add a few customizations.

Closes #89

@ltrzesniewski

ltrzesniewski commented Apr 13, 2026

Copy link
Copy Markdown
Author

I realized this didn't let you remove existing mappings without adding them to the output, so I added second commit which introduces the following convention: if you map a file type to the none category, it will be removed.

I'm not very good at naming, so feel free to suggest better names (I was hesitant between --add-filetypes and --add-database, or none and default for instance).

@rpdelaney

Copy link
Copy Markdown
Collaborator

Hey, thanks for the PR. Can you help me understand what is the use case for this? Is the configuration file not enough?

@ltrzesniewski

ltrzesniewski commented Apr 26, 2026

Copy link
Copy Markdown
Author

Hi, the goal is the same as in #89: I want to do a few changes to the config file, while preserving the defaults. This way:

  • My changes would stand out, I could easily see what changes I applied over the defaults
  • The defaults could be easily kept up to date. If I copy all the content from the default filetypes file and then edit it, I won't benefit from future updates, as applying the custom changes over again would be too tedious.

Currently, you can see how I customize my config: I start from what vivid generates, then patch it to my convenience. I thought it would've been much cleaner if vivid had such a feature built-in, then saw the existing issue confirming my thoughts.

I also thought about adding an option such as --output-type=lscolors|pwsh if you'd be ok with that, but started with this PR to see if it'd be accepted. 🙂

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 this pull request may close these issues.

Adding new filetypes to database (user customization)

2 participants