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!
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

45 satır
1.3KB

  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. from .jail import command_jail_run
  10. def create_parser():
  11. parser_top = ArgumentParser()
  12. subparsers_top = parser_top.add_subparsers()
  13. subparsers = subparsers_top.add_parser('image').add_subparsers()
  14. parser = subparsers.add_parser('build')
  15. parser.set_defaults(func=command_image_build)
  16. parser.add_argument('focker_dir', type=str)
  17. parser.add_argument('--tag', '-t', type=str, nargs='+', default=[])
  18. parser = subparsers.add_parser('untag')
  19. parser.set_defaults(func=command_image_untag)
  20. parser.add_argument('tags', type=str, nargs='+', default=[])
  21. subparsers = subparsers_top.add_parser('jail').add_subparsers()
  22. parser = subparsers.add_parser('run')
  23. parser.set_defaults(func=command_jail_run)
  24. parser.add_argument('image', type=str)
  25. parser.add_argument('--command', '-c', type=str, default='/bin/sh')
  26. return parser_top
  27. def main():
  28. zfs_init()
  29. parser = create_parser()
  30. args = parser.parse_args()
  31. if not hasattr(args, 'func'):
  32. sys.exit('You must choose a mode')
  33. args.func(args)
  34. if __name__ == '__main__':
  35. main()