IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0KB

  1. from argparse import ArgumentParser
  2. import yaml
  3. import os
  4. # from weir import zfs, process
  5. from .image import command_image_build, \
  6. command_image_untag
  7. import sys
  8. from .zfs import zfs_init
  9. def create_parser():
  10. parser_top = ArgumentParser()
  11. subparsers_top = parser_top.add_subparsers()
  12. subparsers = subparsers_top.add_parser('image').add_subparsers()
  13. parser = subparsers.add_parser('build')
  14. parser.set_defaults(func=command_image_build)
  15. parser.add_argument('focker_dir', type=str)
  16. parser.add_argument('--tag', '-t', type=str, nargs='+', default=[])
  17. parser = subparsers.add_parser('untag')
  18. parser.set_defaults(func=command_image_untag)
  19. parser.add_argument('tags', type=str, nargs='+', default=[])
  20. return parser_top
  21. def main():
  22. zfs_init()
  23. parser = create_parser()
  24. args = parser.parse_args()
  25. if not hasattr(args, 'func'):
  26. sys.exit('You must choose a mode')
  27. args.func(args)
  28. if __name__ == '__main__':
  29. main()