def convert_text(self):

        files_to_format = self.get_file_to_format()
        print("Number of files to edit: " + str(len(files_to_format)))
        print("List of files to edit: " + str(files_to_format))
        self.print_space(50)
        for file in files_to_format:
            if not self.from_:
                text_formatter = TextFormatter(self.path, file, 4)
            else:
                if not self.chars:
                    self.chars = 4
                text_formatter = TextFormatter(self.path, file, self.chars)
            print("I am editing the file: " + str(file))
            if self.from_:
                if not self.replace:
                    file_copier = FileCopier(self.path, file)
                    file_copier.copy_file()

            if self.from_ == FromOptions.SPACES.value:
                text_formatter.space_to_tab()
            elif self.from_ == FromOptions.TABS.value:
                text_formatter.tab_to_space()
            else:
                res = text_formatter.analyze_file()
                text_formatter.print_analyze_file(res[0], res[1])
Esempio n. 2
0
 def test_fc_copy_file_without_filename(self):
     file_copier = FileCopier(self.main_dir, None)
     res = file_copier.copy_file()
     self.assertEqual(res, None)
Esempio n. 3
0
 def test_fc_copy_file_with_empty_string_as_filename(self):
     file_copier = FileCopier(self.main_dir, "")
     res = file_copier.copy_file()
     self.assertEqual(res, None)
Esempio n. 4
0
 def test_fc_copy_file(self):
     file_copier = FileCopier(self.main_dir, "lorem_different_indents.txt")
     res = file_copier.copy_file()
     self.assertEqual(
         True,
         filecmp.cmp(self.main_dir + "/lorem_different_indents.txt", res))
Esempio n. 5
0
    def test_get_none_1_from_fc_get_filename_without_extension(self):
        file_copier = FileCopier(self.main_dir, None)

        res = file_copier.get_filename_without_extension()

        self.assertEqual(res, None)
Esempio n. 6
0
    def test_fc_get_correct_filename_without_extension(self):
        file_copier = FileCopier(self.main_dir, "lorem_different_indents.txt")

        res = file_copier.get_filename_without_extension()

        self.assertEqual(res, "lorem_different_indents")
Esempio n. 7
0
from file_eraser import FileEreaser
from file_mover import FileMover
from file_copier import FileCopier
from file_creator import FileCreator

print('[1] - File Eraser;'
      '\n[2] - File Mover;'
      '\n[3] - File Copier; '
      '\n[4] - File Creator;')

option = int(input('Option: '))

if option == 1:
    FileEreaser.start()

elif option == 2:
    FileMover.start()

elif option == 3:
    FileCopier.start()

elif option == 4:
    FileCreator.start()