1
0
Fork 0
mirror of synced 2024-05-19 11:42:40 +12:00

Rename --skip to --skip-format

This commit is contained in:
Ali Parlakci 2021-05-16 19:47:57 +03:00 committed by Serene
parent 739f97edcc
commit f768a7d61c
6 changed files with 7 additions and 7 deletions

View file

@ -161,7 +161,7 @@ The following options apply only to the `download` command. This command downloa
- `--skip-domain`
- This adds domains to the download filter i.e. submissions coming from these domains will not be downloaded
- Can be specified multiple times
- `--skip`
- `--skip-format`
- This adds file types to the download filter i.e. submissions with one of the supplied file extensions will not be downloaded
- Can be specified multiple times
- `--skip-subreddit`

View file

@ -53,7 +53,7 @@ def cli():
@click.option('--max-wait-time', type=int, default=None)
@click.option('--no-dupes', is_flag=True, default=None)
@click.option('--search-existing', is_flag=True, default=None)
@click.option('--skip', default=None, multiple=True)
@click.option('--skip-format', default=None, multiple=True)
@click.option('--skip-domain', default=None, multiple=True)
@click.option('--skip-subreddit', default=None, multiple=True)
@_add_common_options

View file

@ -26,7 +26,7 @@ class Configuration(Namespace):
self.search_existing: bool = False
self.file_scheme: str = '{REDDITOR}_{TITLE}_{POSTID}'
self.folder_scheme: str = '{SUBREDDIT}'
self.skip: list[str] = []
self.skip_format: list[str] = []
self.skip_domain: list[str] = []
self.skip_subreddit: list[str] = []
self.sort: str = 'hot'

View file

@ -379,7 +379,7 @@ class RedditDownloader:
return RedditTypes.SortType.HOT
def _create_download_filter(self) -> DownloadFilter:
return DownloadFilter(self.args.skip, self.args.skip_domain)
return DownloadFilter(self.args.skip_format, self.args.skip_domain)
def _create_authenticator(self) -> SiteAuthenticator:
return SiteAuthenticator(self.cfg_parser)

View file

@ -56,7 +56,7 @@ def test_determine_directories(tmp_path: Path, downloader_mock: MagicMock):
(['.test'], ['test.com'],),
))
def test_create_download_filter(skip_extensions: list[str], skip_domains: list[str], downloader_mock: MagicMock):
downloader_mock.args.skip = skip_extensions
downloader_mock.args.skip_format = skip_extensions
downloader_mock.args.skip_domain = skip_domains
result = RedditDownloader._create_download_filter(downloader_mock)

View file

@ -166,8 +166,8 @@ def test_cli_download_search_existing(test_args: list[str], tmp_path: Path):
@pytest.mark.reddit
@pytest.mark.skipif(not does_test_config_exist, reason='A test config file is required for integration tests')
@pytest.mark.parametrize('test_args', (
['--subreddit', 'tumblr', '-L', '25', '--skip', 'png', '--skip', 'jpg'],
['--subreddit', 'MaliciousCompliance', '-L', '25', '--skip', 'txt'],
['--subreddit', 'tumblr', '-L', '25', '--skip-format', 'png', '--skip-format', 'jpg'],
['--subreddit', 'MaliciousCompliance', '-L', '25', '--skip-format', 'txt'],
))
def test_cli_download_download_filters(test_args: list[str], tmp_path: Path):
runner = CliRunner()