def main(): cfg.set_defaults() if len(sys.argv) > 1: param_file_name, no_valid_flags = parse_sys_args(sys.argv) cfg.source_file_name = param_file_name # Load the config if it hasn't been set. # This will only be false when running in module transpile mode. if not cfg.ask_config: askfile.load() if not param_file_name and True in [ x in sys.argv for x in ['-d', '--dev', '-xd', '--extra-dev'] ]: repl(True) if not cfg.is_module_transpile: printing.initial_print() if os.path.isfile(f'{os.getcwd()}/{cfg.source_file_name}'): transpiler.transpile_from_file() if askfile.get(['system', 'server'], True): # Starts server serve_run.run_server() elif not cfg.is_module_transpile: printing.style_print('\nAuto start server is turned OFF.', styles=['bold']) print('\t - The transpiled code can be found in:', end=' ') printing.style_print(askfile.get(['system', 'output_path'], 'app.py'), color='blue', end='') print('.') else: if no_valid_flags: if param_file_name[0] == '-': style_print(f'- Invalid flag "{param_file_name}".', color='yellow') exit(1) printing.style_print('- The file could not be found!', color='red') exit(1) # Deletes the output file if configured to. files.maybe_delete_app() else: repl(True)
def setUp(cls) -> None: cfg.set_defaults()
serve_run.run_server() elif not cfg.is_module_transpile: printing.style_print('\nAuto start server is turned OFF.', styles=['bold']) print('\t - The transpiled code can be found in:', end=' ') printing.style_print(askfile.get(['system', 'output_path'], 'app.py'), color='blue', end='') print('.') else: if no_valid_flags: if param_file_name[0] == '-': style_print(f'- Invalid flag "{param_file_name}".', color='yellow') exit(1) printing.style_print('- The file could not be found!', color='red') exit(1) # Deletes the output file if configured to. files.maybe_delete_app() else: repl(True) if __name__ == '__main__': cfg.set_defaults() main()