def onlycopy(ctx, srcdir, srcfile, checkdir, relpath, failonerror, include_regex, include_src_regex, include_dst_regex):
"""
onlycopy command prints list of all the files that aren't in the srcdir
"""
if not (srcdir or srcfile):
raise click.BadOptionUsage("The regex didn't compile. For correct usage"
" see: https://docs.python.org/2/library/re.html")
# validate the regex options
check_regex(include_regex)
if include_regex is not None:
include_src_regex = include_regex
include_dst_regex = include_regex
check_regex(include_src_regex)
check_regex(include_dst_regex)
if relpath:
basepath = os.getcwd()
for i in onlycopy_yield(srcdir, checkdir, failonerror, src_regex=include_src_regex, dst_regex=include_dst_regex,
srcfile=srcfile):
click.echo(os.path.relpath(i, basepath))
else:
for i in onlycopy_yield(srcdir, checkdir, failonerror, src_regex=include_src_regex, dst_regex=include_dst_regex,
srcfile=srcfile):
click.echo(i)
评论列表
文章目录