[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')
|
-N, --print [EVENT:]FORMAT Write FORMAT during EVENT (default 'prepare')
|
||||||
to standard output. Examples: 'id' or
|
to standard output. Examples: 'id' or
|
||||||
'post:{md5[:8]}'
|
'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
|
--print-to-file [EVENT:]FORMAT FILE
|
||||||
Append FORMAT during EVENT to FILE
|
Append FORMAT during EVENT to FILE
|
||||||
--list-modules Print a list of available extractor modules
|
--list-modules Print a list of available extractor modules
|
||||||
|
|||||||
@@ -156,7 +156,11 @@ class UgoiraAction(argparse.Action):
|
|||||||
class PrintAction(argparse.Action):
|
class PrintAction(argparse.Action):
|
||||||
def __call__(self, parser, namespace, value, option_string=None):
|
def __call__(self, parser, namespace, value, option_string=None):
|
||||||
if self.const:
|
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
|
base = None
|
||||||
mode = "w"
|
mode = "w"
|
||||||
else:
|
else:
|
||||||
@@ -397,6 +401,13 @@ def build_parser():
|
|||||||
help=("Write FORMAT during EVENT (default 'prepare') to standard "
|
help=("Write FORMAT during EVENT (default 'prepare') to standard "
|
||||||
"output. Examples: 'id' or 'post:{md5[:8]}'"),
|
"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(
|
output.add_argument(
|
||||||
"--print-to-file",
|
"--print-to-file",
|
||||||
dest="postprocessors", metavar="[EVENT:]FORMAT FILE",
|
dest="postprocessors", metavar="[EVENT:]FORMAT FILE",
|
||||||
|
|||||||
Reference in New Issue
Block a user