ytcc icon indicating copy to clipboard operation
ytcc copied to clipboard

[Request] Portable configuration

Open pukkandan opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Portable configuration and database

Describe the solution you'd like

ytcc should look for a config file in the same directory as the executable and prioritize it over the other configs. When this "portable" config file is detected, the default db path, download path etc should also be set relative to the executable's path.

I can make a PR for this if needed

pukkandan avatar Sep 04 '22 03:09 pukkandan

What's the usecase? You can override the config lookup path by setting the YTCC_CONFIG env variable or passing ytcc the --conf option.

woefe avatar Oct 02 '22 12:10 woefe

You can override the config lookup path by setting the YTCC_CONFIG env variable or passing ytcc the --conf option.

That is what I am doing now. Since I want don't want to pass --conf each time, I had to create a wrapper script that calls ytcc --conf ... and also explicitly define relative paths for download, db etc.

Built-in support for a portable config would make this much easier. But if you think the current option is good enough, feel free to close the issue

pukkandan avatar Oct 02 '22 12:10 pukkandan

I don't see why we need to change anything in ytcc, because you can emulate a portable config with

export YTCC_CONFIG=.ytcc.conf

If .ytcc.conf does not exist in the current working directory, configuration is read from the usual places. Additionally, you can create "incomplete" config files that override only the settings you want to change for a certain directory.

In your case following might help:

  1. Instead of writing a wrapper, export YTCC_CONFIG=.ytcc.conf in your shellrc or similar.
  2. In directories where you want to override some ytcc settings create configs that override the defaults. E.g.
    [ytcc]
    download_dir = downloads
    db_path = ytcc.db
    

woefe avatar Oct 22 '22 16:10 woefe