Skip to content

Commit ae9372b

Browse files
committed
smartplaylist: Improve apply_opts_to_config
since we require handling of store_true cli options something for the `quiet`
1 parent e8286cb commit ae9372b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

beetsplug/smartplaylist.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,15 @@ def update_cmd(self, lib: Library, opts: Any, args: list[str]) -> None:
184184
self.update_playlists(lib, opts.pretend)
185185

186186
def __apply_opts_to_config(self, opts: Any) -> None:
187+
"""Apply explicitly set command-line options to the plugin configuration.
188+
189+
Only explicitly set values are written. Boolean ``False`` (the default
190+
for ``store_true`` flags) is skipped so that an unset flag does not
191+
overwrite a ``true`` value already set in the config file. Other falsy
192+
values (e.g. an empty string for ``--prefix``) are still applied.
193+
"""
187194
for k, v in opts.__dict__.items():
188-
if v is not None and k in self.config:
195+
if v is not False and v is not None and k in self.config:
189196
self.config[k] = v
190197

191198
def _parse_one_query(

0 commit comments

Comments
 (0)