Exemplo n.º 1
0
    def do_interpret(self, line):
        if self.write_folder is None:
            print("""Please enter the directory to write files to :
Syntax : write_folder [folder name]
Example : write_folder out
Result : Folder to write files are /[folder name]""")
        elif self.source_file is None:
            print("Please enter the source file : source [file_name]")
        else:
            uml = Interpreter()
            uml.add_file(self.source_file, self.write_folder)
            uml.write_modules()
            if len(uml.all_my_errors) > 0:
                for an_error in uml.all_my_errors:
                    print(an_error)
            print("Interpreting complete")
Exemplo n.º 2
0
 def do_convert(self, line):
     arg = self.file_path(line)
     try:
         if not path.isfile(arg[0]):
             print(f"{arg[0]} is not a FILE")
         if path.isdir(arg[1]):
             pass
         else:
             print(f"{arg[1]} is not a DIR")
     except Exception as e:  # pragma: no cover
         print(e)
     if len(arg) == 2:
         converter = Interpreter()
         converter.add_file(arg[0], arg[1])
         converter.write_modules()
         """
         if len(converter.all_my_errors) > 0:
             for an_error in converter.all_my_errors:
                 print(an_error)
         """
         print("process complete")
Exemplo n.º 3
0
 def do_interpret(self, line):
     """
         ***
         Translates your SOURCE plantUML file to a python file
         in the ROOT directory provided
         Update ROOT directory: root [file_location]
         Update SOURCE file: source [source_file]
         ***
     """
     if self.root is None:
         print("Please enter the directory to write files to : root xxxx")
     elif self.source is None:
         print("Please enter the source file : source xxxx")
     else:
         x = Interpreter()
         x.add_file(self.source, self.root)
         x.write_modules()
         if len(x.all_my_errors) > 0:
             for an_error in x.all_my_errors:
                 print(an_error)
         print("Interpreting complete")
Exemplo n.º 4
0
                 ***
            """)
        
    def help_source(self):
        print("""***
                 Update SOURCE file: source [source_file]
                 This file will be interpreted
                 ***
            """)
        
    def help_root(self, line):
        print("""***
                 Update ROOT directory: root [file_location]
                 Files will be created here
                 ***
            """)

    def postloop(self):
        print

if __name__ == '__main__':
    
    if len(sys.argv) > 1:
        root_directory = sys.argv[1]
        source_file = sys.argv[2]
        x = Interpreter()
        x.add_file(source_file, root_directory)
        x.write_modules()
        print(f"Python files created in {root_directory}")
    else:
        Controller().cmdloop()