bam cli: add --quiet argument (only used for packing)
This commit is contained in:
@@ -821,7 +821,12 @@ class bam_commands:
|
|||||||
print(" %r -> (%r = %r) %s" % (f_src, f_dst, f_dst_abs, f_status))
|
print(" %r -> (%r = %r) %s" % (f_src, f_dst, f_dst_abs, f_status))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pack(paths, output, all_deps=False):
|
def pack(
|
||||||
|
paths,
|
||||||
|
output,
|
||||||
|
all_deps=False,
|
||||||
|
use_quiet=False,
|
||||||
|
):
|
||||||
# Local packing (don't use any project/session stuff)
|
# Local packing (don't use any project/session stuff)
|
||||||
import blendfile_pack
|
import blendfile_pack
|
||||||
|
|
||||||
@@ -829,13 +834,19 @@ class bam_commands:
|
|||||||
path = paths[0]
|
path = paths[0]
|
||||||
del paths
|
del paths
|
||||||
|
|
||||||
|
if use_quiet:
|
||||||
|
report = lambda msg: None
|
||||||
|
else:
|
||||||
|
report = lambda msg: print(msg, end="")
|
||||||
|
|
||||||
for msg in blendfile_pack.pack(
|
for msg in blendfile_pack.pack(
|
||||||
path.encode('utf-8'),
|
path.encode('utf-8'),
|
||||||
output.encode('utf-8'),
|
output.encode('utf-8'),
|
||||||
'ZIP',
|
'ZIP',
|
||||||
all_deps=all_deps,
|
all_deps=all_deps,
|
||||||
|
report=report,
|
||||||
):
|
):
|
||||||
print(msg, end="")
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remap_start(
|
def remap_start(
|
||||||
@@ -914,6 +925,7 @@ def init_argparse_common(
|
|||||||
subparse,
|
subparse,
|
||||||
use_json=False,
|
use_json=False,
|
||||||
use_all_deps=False,
|
use_all_deps=False,
|
||||||
|
use_quiet=False,
|
||||||
):
|
):
|
||||||
if use_json:
|
if use_json:
|
||||||
subparse.add_argument(
|
subparse.add_argument(
|
||||||
@@ -925,6 +937,11 @@ def init_argparse_common(
|
|||||||
"-a", "--all-deps", dest="all_deps", action='store_true',
|
"-a", "--all-deps", dest="all_deps", action='store_true',
|
||||||
help="Follow all dependencies (unused indirect dependencies too)",
|
help="Follow all dependencies (unused indirect dependencies too)",
|
||||||
)
|
)
|
||||||
|
if use_quiet:
|
||||||
|
subparse.add_argument(
|
||||||
|
"-q", "--quiet", dest="use_quiet", action='store_true',
|
||||||
|
help="Suppress status output",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_argparse_init(subparsers):
|
def create_argparse_init(subparsers):
|
||||||
@@ -1109,14 +1126,15 @@ def create_argparse_pack(subparsers):
|
|||||||
help="Output file or a directory when multiple inputs are passed",
|
help="Output file or a directory when multiple inputs are passed",
|
||||||
)
|
)
|
||||||
|
|
||||||
init_argparse_common(subparse, use_all_deps=True)
|
init_argparse_common(subparse, use_all_deps=True, use_quiet=True)
|
||||||
|
|
||||||
subparse.set_defaults(
|
subparse.set_defaults(
|
||||||
func=lambda args:
|
func=lambda args:
|
||||||
bam_commands.pack(
|
bam_commands.pack(
|
||||||
args.paths,
|
args.paths,
|
||||||
args.output,
|
args.output,
|
||||||
all_deps=args.all_deps),
|
all_deps=args.all_deps,
|
||||||
|
use_quiet=args.use_quiet),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user