def set_arguments(self):
        try:
            version = pkg_resources.get_distribution("atomic_reactor").version
        except pkg_resources.DistributionNotFound:
            version = "GIT"

        exclusive_group = self.parser.add_mutually_exclusive_group()
        exclusive_group.add_argument("-q", "--quiet", action="store_true")
        exclusive_group.add_argument("-v", "--verbose", action="store_true")
        exclusive_group.add_argument("-V", "--version", action="version", version=version)

        subparsers = self.parser.add_subparsers(help='commands')

        # BUILDING IMAGES

        self.build_parser = subparsers.add_parser(
            'build',
            usage="%s [OPTIONS] build" % PROG,
            description='This command enables you to build images. '
                        'Currently, you can build images from git repo, local path or '
                        'a json file with full build specification. '
                        'There are several methods for performing the build: '
                        'inside a build container using docker from host, '
                        'inside a build container using new instance of docker, '
                        'or within current environment.'
        )
        def cli_build_with_source(args):
            if args.source__provider is None:
                self.build_parser.print_help()
            else:
                cli_build_image(args)

        self.build_parser.set_defaults(func=cli_build_with_source)
        self.generate_source_types_subparsers()

        # CREATE BUILD IMAGE

        self.bi_parser = subparsers.add_parser('create-build-image',
                                               usage="%s [OPTIONS] create-build-image" % PROG,
                                               description='Create build image; Atomic Reactor installs itself inside and '
                                                           'is capable of building images within this image.')
        self.bi_parser.set_defaults(func=cli_create_build_image)
        reactor_source = self.bi_parser.add_mutually_exclusive_group()
        reactor_source.add_argument("--reactor-latest", action='store_true',
                                 help="put latest Atomic Reactor inside (from public git)")
        reactor_source.add_argument("--reactor-remote-git", action='store',
                                 help="URL to git repo with Atomic Reactor (has to contain setup.py)")
        reactor_source.add_argument("--reactor-local-path", action='store',
                                 help="path to directory with Atomic Reactor (has to contain setup.py)")
        reactor_source.add_argument("--reactor-tarball-path", action='store',
                                 help="path to distribution tarball with Atomic Reactor")
        self.bi_parser.add_argument("dockerfile_dir_path", action="store", metavar="DOCKERFILE_DIR_PATH",
                                    help="path to directory with Dockerfile")
        self.bi_parser.add_argument("image", action='store', metavar="IMAGE",
                                    help="name under the image will be accessible")
        self.bi_parser.add_argument("--use-cache", action='store_true', default=False,
                                    help="use cache to build image (may be faster, but not up to date)")

        # inside build
        self.ib_parser = subparsers.add_parser(
            'inside-build',
            usage="%s [OPTIONS] inside-build" % PROG,
            description="We do expect we are inside container, therefore we'll read "
                        "build configuration from json at '%s'" % CONTAINER_BUILD_JSON_PATH +
                        "and when the build is done, "
                        "results are written in that dir so Atomic Reactor from host may read those.")
        self.ib_parser.add_argument("--input", action='store', default="auto",
                                    help="input plugin name (determined automatically unless given)")
        self.ib_parser.add_argument("--input-arg", action='append',
                                    help="argument for input plugin (in form of 'key=value'), see input plugins "
                                         " to know what arguments they accept (can be specified multiple times)")
        self.ib_parser.add_argument("--dont-pull-base-image", action='store_true',
                                    help="don't pull or update base image specified in dockerfile")
        self.ib_parser.add_argument("--substitute", action='append',
                                    help="substitute values in build json (key=value, or "
                                         "plugin_type.plugin_name.key=value)")
        self.ib_parser.set_defaults(func=cli_inside_build)
dataset/ETHPy150Open projectatomic/atomic-reactor/atomic_reactor/cli/main.py/CLI.set_arguments/original