[options] add '--Print' command-line option
This commit is contained in:
@@ -51,6 +51,8 @@
|
||||
-N, --print [EVENT:]FORMAT Write FORMAT during EVENT (default 'prepare')
|
||||
to standard output. Examples: 'id' or
|
||||
'post:{md5[:8]}'
|
||||
--Print [EVENT:]FORMAT Like --print, but also sets --no-download,
|
||||
--no-skip, and disables other output to stdout
|
||||
--print-to-file [EVENT:]FORMAT FILE
|
||||
Append FORMAT during EVENT to FILE
|
||||
--list-modules Print a list of available extractor modules
|
||||
|
||||
@@ -156,7 +156,11 @@ class UgoiraAction(argparse.Action):
|
||||
class PrintAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, value, option_string=None):
|
||||
if self.const:
|
||||
filename = self.const
|
||||
if self.const == "+":
|
||||
namespace.options.append(((), "skip", False))
|
||||
namespace.options.append(((), "download", False))
|
||||
namespace.options.append((("output",), "mode", False))
|
||||
filename = "-"
|
||||
base = None
|
||||
mode = "w"
|
||||
else:
|
||||
@@ -397,6 +401,13 @@ def build_parser():
|
||||
help=("Write FORMAT during EVENT (default 'prepare') to standard "
|
||||
"output. Examples: 'id' or 'post:{md5[:8]}'"),
|
||||
)
|
||||
output.add_argument(
|
||||
"--Print",
|
||||
dest="postprocessors", metavar="[EVENT:]FORMAT",
|
||||
action=PrintAction, const="+",
|
||||
help=("Like --print, but also sets --no-download, --no-skip, "
|
||||
"and disables other output to stdout"),
|
||||
)
|
||||
output.add_argument(
|
||||
"--print-to-file",
|
||||
dest="postprocessors", metavar="[EVENT:]FORMAT FILE",
|
||||
|
||||
Reference in New Issue
Block a user