From b6d58f4aecf452eb46d0e2190f56b512fb717e8d Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Mon, 6 Jan 2020 16:28:58 -0800 Subject: Prevent unintended behavior when combining -o and -a When batch downloading files with -a, specifying an output name with -o will result in only the first file being downloaded. If -f is also given, then only the last file is kept (with the previous ones being overwritten). This is not ideal behavior, so the ability to specify an output filename has been disabled when running wikiget in batch mode. In the future, -o could be used as a template string or prefix when in batch mode, along the lines of what youtube-dl does. --- wikiget/wikiget.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'wikiget') diff --git a/wikiget/wikiget.py b/wikiget/wikiget.py index d272f96..566448f 100644 --- a/wikiget/wikiget.py +++ b/wikiget/wikiget.py @@ -63,25 +63,27 @@ def main(): """) parser.add_argument('-V', '--version', action='version', version='%(prog)s {}'.format(__version__)) - output_options = parser.add_mutually_exclusive_group() - output_options.add_argument('-q', '--quiet', - help='suppress warning messages', - action='store_true') - output_options.add_argument('-v', '--verbose', - help='print detailed information; ' - 'use -vv for even more detail', - action='count', default=0) + message_options = parser.add_mutually_exclusive_group() + message_options.add_argument('-q', '--quiet', + help='suppress warning messages', + action='store_true') + message_options.add_argument('-v', '--verbose', + help='print detailed information; ' + 'use -vv for even more detail', + action='count', default=0) parser.add_argument('-f', '--force', help='force overwriting existing files', action='store_true') parser.add_argument('-s', '--site', default=DEFAULT_SITE, help='MediaWiki site to download from ' '(default: %(default)s)') - parser.add_argument('-o', '--output', help='write download to OUTPUT') - parser.add_argument('-a', '--batch', - help='treat FILE as a textfile containing multiple ' - 'files to download, one URL or filename per line', - action='store_true') + output_options = parser.add_mutually_exclusive_group() + output_options.add_argument('-o', '--output', + help='write download to OUTPUT') + output_options.add_argument('-a', '--batch', + help='treat FILE as a textfile containing ' + 'multiple files to download, one URL or ' + 'filename per line', action='store_true') args = parser.parse_args() -- cgit v1.2.3