Migrate scripts to vlogging.main_decorator.

This commit is contained in:
voussoir 2021-06-21 22:11:19 -07:00
parent ce80bb32a7
commit 5ce6cf8425
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
16 changed files with 16 additions and 30 deletions

View file

@ -46,9 +46,8 @@ def adbinstall_argparse(args):
log.info(command)
os.system(command)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('apks', nargs='+')

View file

@ -63,9 +63,8 @@ def bitwise_or_argparse(args):
output_handle.write(chunk.to_bytes(length, 'big'))
pipeable.stdout(output.absolute_path)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('files', nargs='+')

View file

@ -74,9 +74,8 @@ def contentreplace_argparse(args):
except UnicodeDecodeError:
log.error('%s encountered unicode decode error.', file.absolute_path)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('filename_glob')

View file

@ -116,8 +116,8 @@ def fpk_argparse(args):
return return_status
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
(notify_context, argv) = operatornotify.main_log_context(argv, subject='fdroidapk warnings')
parser = argparse.ArgumentParser(description=__doc__)

View file

@ -131,9 +131,8 @@ def ffstreams_argparse(args):
moveto=args.moveto,
)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('input_filename', nargs='+')
parser.add_argument('--moveto', default=None)

View file

@ -65,9 +65,8 @@ def hash_hardlink_argparse(args):
send2trash.send2trash(follower.absolute_path)
os.link(leader.absolute_path, follower.absolute_path)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('paths', nargs='+')

View file

@ -29,9 +29,8 @@ def heresmyclipboard_argparse(args):
log.info(f'Starting server on port {args.port}, pid={os.getpid()}')
site.run(host='0.0.0.0', port=args.port)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('port', nargs='?', type=int, default=4848)

View file

@ -148,9 +148,8 @@ def check_forever():
else:
time.sleep(20)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
try:
check_forever()
except KeyboardInterrupt:

View file

@ -527,8 +527,8 @@ def rarpar_argparse(args):
return status
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
(notify_context, argv) = operatornotify.main_log_context(argv, subject='rarpar warnings')
parser = argparse.ArgumentParser(description=__doc__)

View file

@ -56,9 +56,8 @@ def reserve_disk_space_argparse(args):
log.fatal('Only %s available out of %s.', free, reserve)
return 1
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('reserve')

View file

@ -84,9 +84,8 @@ def resize_argparse(args):
quality=args.quality,
)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('pattern')

View file

@ -41,9 +41,8 @@ def rotate_argparse(args):
pipeable.stdout(newname)
image.save(newname, exif=exif, quality=args.quality)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('pattern')

View file

@ -55,9 +55,8 @@ def sole_lift_argparse(args):
os.rmdir(temp_dir.absolute_path)
queue.append(directory.parent)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('starting', nargs='?', default='.')

View file

@ -12,9 +12,8 @@ def printstderr_argparse(args):
for line in text:
pipeable.stderr(line)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('texts', nargs='+')

View file

@ -12,9 +12,8 @@ def printstdout_argparse(args):
for line in text:
pipeable.stdout(line)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('texts', nargs='+')

View file

@ -43,9 +43,8 @@ def stitch_argparse(args):
log.info(args.output)
final_image.save(args.output)
@vlogging.main_decorator
def main(argv):
argv = vlogging.main_level_by_argv(argv)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('image_files', nargs='+')