예제 #1
0
    def handle_init(self, args):
        # Make sure it's safe to initialize

        file_operator = get_operator()
        if file_operator:
            if not args.force:
                print('Repo {} already initialized for Git Gud.'.format(
                    file_operator.path))
                print('Use --force to initialize {}.'.format(Path.cwd()))
                if file_operator.path != Path.cwd():
                    print('{} will be left as is.'.format(
                        file_operator.gg_path))  # noqa: E501
                return
            else:
                print('Force initializing Git Gud.')
        elif len(list(Path.cwd().iterdir())) != 0:
            if not (args.force and args.prettyplease):
                print(
                    'Current directory is nonempty. Initializing will delete all files.'
                )  # noqa: E501
                print('Use --force --prettyplease to force initialize here.')
                return
            else:
                print('Deleting all files.')
                print('Initializing Git Gud.')

        file_operator = Operator(Path.cwd())
        file_operator.init_gg()

        print()

        self.load_level(all_skills["0"]["1"])
예제 #2
0
    def handle_init(self, args):
        # Make sure it's safe to initialize

        file_operator = get_operator()
        if file_operator:
            if not args.force:
                repo_already_initialized()
                return
            else:
                force_initializing()
        elif len(list(Path.cwd().iterdir())) != 0:
            if not (args.force and args.prettyplease):
                cant_init_repo_not_empty()
                return
            else:
                deleting_and_initializing()

        file_operator = Operator(Path.cwd())
        file_operator.init_gg()

        self.load_level(all_skills["0"]["1"])