1.3 KiB
title | date |
---|---|
Built in aliases are great and we should do them more | 2025-03-16 23:40:02 -5000 |
I have definitely mentioned it before, but if not: I am a big fan of yt-dlp. Having videos offline (without having to pay for youtubes terrible service) is very nice, especially with the looming risk of blocking adblockers. That's not exactly what I want to talk about today, though. Like most other command line programs, it features command line switches, and a config file. The way yt-dlp handles their config is by simply listing the switches in a file, which is not UNcommon in the field. What is, is one switch in particular: --alias. Alias lets you name your OWN switches, using existing switches. Defining aliases on the command line side is nearly pointless, since you're just writing out the whole list of switches anyway. The real power comes from defining aliases in the config, since it effectively lets you mod your own switches and reuse them anywhere. They even show up in the --help listing! This level of aliasing is usually only possible with the built-in "alias" command, and that has a ton of issues and annoyances (only being available from a login shell, being unable to mix two aliases for the same program, no way to provide parameters in most places, etc), so having it available built in to yt-dlp is quite handy.