def execute(self, arguments: list, hierarchy_manager: HierarchyManager):
     Helper().validate_arguments(arguments)
     dir_name = arguments[0]
     if dir_name == '..':
         hierarchy_manager.current_dir = hierarchy_manager.current_dir.parent
     else:
         child_dirs = hierarchy_manager.current_dir.getDirectories().keys()
         if dir_name in child_dirs:
             hierarchy_manager.current_dir = hierarchy_manager.current_dir.getDirectories(
             )[dir_name]
         else:
             raise Exception("Invalid directory")
 def execute(self, arguments: list, hierarchy_manager: HierarchyManager):
     current_dir = hierarchy_manager.getCurrentDir()
     directory_content = list(current_dir.getDirectories().keys()) + list(
         current_dir.getFiles().keys())
     for i in directory_content:
         print(i, end=' ')
     print()
 def execute(self, arguments: list, hierarchy_manager: HierarchyManager):
     try:
         dir_name = arguments[0]
     except IndexError as e:
         raise e
     else:
         current_dir = hierarchy_manager.getCurrentDir()
         if dir_name in current_dir.getDirectories():
             del current_dir.getDirectories()[dir_name]
         else:
             raise Exception('Directory not found')
    def execute(self, arguments: list, hierarchy_manager: HierarchyManager):
        Helper().validate_arguments(arguments)

        dir_name = arguments[0]
        current_dir = hierarchy_manager.getCurrentDir()

        Helper().validate_duplication(dir_name, current_dir)

        metadata = Metadata(dir_name)
        directory = Directory(metadata, current_dir)
        current_dir.addDirectory(directory)
 def reset(self):
     self.hierarchy_manager = HierarchyManager()
     self.executor = Executor(self.hierarchy_manager)
 def __init__(self):
     self.hierarchy_manager = HierarchyManager()
     self.executor = Executor(self.hierarchy_manager)
 def execute(self, arguments: list, hierarchy_manager: HierarchyManager):
     current_dir = hierarchy_manager.getCurrentDir()
     print(current_dir.get_path())