Add option to classes

This commit is contained in:
Serene-Arc 2023-01-04 19:04:31 +10:00
parent f40ac35f4a
commit 4f07e92c5e
3 changed files with 7 additions and 1 deletions

View File

@ -20,15 +20,16 @@ _common_options = [
click.argument("directory", type=str),
click.option("--authenticate", is_flag=True, default=None),
click.option("--config", type=str, default=None),
click.option("--opts", type=str, default=None),
click.option("--disable-module", multiple=True, default=None, type=str),
click.option("--exclude-id", default=None, multiple=True),
click.option("--exclude-id-file", default=None, multiple=True),
click.option("--file-scheme", default=None, type=str),
click.option("--filename-restriction-scheme", type=click.Choice(("linux", "windows")), default=None),
click.option("--folder-scheme", default=None, type=str),
click.option("--ignore-user", type=str, multiple=True, default=None),
click.option("--include-id-file", multiple=True, default=None),
click.option("--log", type=str, default=None),
click.option("--opts", type=str, default=None),
click.option("--saved", is_flag=True, default=None),
click.option("--search", default=None, type=str),
click.option("--submitted", is_flag=True, default=None),

View File

@ -23,6 +23,7 @@ class Configuration(Namespace):
self.exclude_id = []
self.exclude_id_file = []
self.file_scheme: str = "{REDDITOR}_{TITLE}_{POSTID}"
self.filename_restriction_scheme = None
self.folder_scheme: str = "{SUBREDDIT}"
self.ignore_user = []
self.include_id_file = []

View File

@ -107,6 +107,10 @@ class RedditConnector(metaclass=ABCMeta):
self.args.time_format = option
if not self.args.disable_module:
self.args.disable_module = [self.cfg_parser.get("DEFAULT", "disabled_modules", fallback="")]
if not self.args.filename_restriction_scheme:
self.args.filename_restriction_scheme = self.cfg_parser.get(
"DEFAULT", "filename_restriction_scheme", fallback=None
)
# Update config on disk
with open(self.config_location, "w") as file:
self.cfg_parser.write(file)