Beispiel #1
0
def print_files(opts, file_paths):
    """
    Prints the file paths that will be parsed.

    :param file_paths:
    """
    print("Parsing the following files:")
    for file_path in file_paths:
        print("  " + strip_prefix(file_path, opts.abs_input))
    print("--------------------")
    print(str(len(file_paths)) + " total\n")
Beispiel #2
0
def print_files(opts, file_paths):
    """
    Prints the file paths that will be parsed.

    :param file_paths:
    """
    print("Parsing the following files:")
    for file_path in file_paths:
        print("  " + strip_prefix(file_path, opts.abs_input))
    print("--------------------")
    print(str(len(file_paths)) + " total\n")
Beispiel #3
0
def print_modified_files(opts, anchors):
    """
    Prints out which files were modified amongst those looked at

    :param anchors: Dictionary mapping file path strings to dictionaries
        containing AnchorHub tag/generated header key-value pairs
    """
    print("Files with modifications:")
    for file_path in anchors:
        print("  " + strip_prefix(file_path, opts.abs_input))
    print("--------------------")
    print(str(len(anchors)) + " total\n")
Beispiel #4
0
def print_modified_files(opts, anchors):
    """
    Prints out which files were modified amongst those looked at

    :param anchors: Dictionary mapping file path strings to dictionaries
        containing AnchorHub tag/generated header key-value pairs
    """
    print("Files with modifications:")
    for file_path in anchors:
        print("  " + strip_prefix(file_path, opts.abs_input))
    print("--------------------")
    print(str(len(anchors)) + " total\n")
Beispiel #5
0
    def _write_with_opts(self, file_path, lines, opts):
        """

        :param file_path:
        :param lines:
        :param opts
        """
        if opts.overwrite:
            self._write_file_with_list(file_path, lines)
        else:
            if opts.is_dir:
                # Directory style output
                write_path = opts.abs_output + strip_prefix(file_path, opts.abs_input)
            else:
                write_path = opts.abs_output + opts.input  # single file output
            self._create_dirs_if_necessary(write_path)
            self._write_file_with_list(write_path, lines)
Beispiel #6
0
    def _write_with_opts(self, file_path, lines, opts):
        """

        :param file_path:
        :param lines:
        :param opts
        """
        if opts.overwrite:
            self._write_file_with_list(file_path, lines)
        else:
            if opts.is_dir:
                # Directory style output
                write_path = opts.abs_output + strip_prefix(file_path,
                                                            opts.abs_input)
            else:
                write_path = opts.abs_output + opts.input  # single file output
            self._create_dirs_if_necessary(write_path)
            self._write_file_with_list(write_path, lines)