Skip to content

Commit

Permalink
Merge pull request #332 from p4rti-s/patch-1
Browse files Browse the repository at this point in the history
Update cli.py
  • Loading branch information
LeonOstrez authored Dec 26, 2023
2 parents c6e9ead + 5d9caa0 commit ab550ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pilot/helpers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def check_if_command_successful(convo, command, cli_response, response, exit_cod

return response


def build_directory_tree(path, prefix='', is_root=True, ignore=None):
"""Build the directory tree structure in a simplified format.
Expand All @@ -357,10 +356,10 @@ def build_directory_tree(path, prefix='', is_root=True, ignore=None):
indent = ' '

if os.path.isdir(path):
dir_name = os.path.basename(path)
if is_root:
output += '/'
else:
dir_name = os.path.basename(path)
output += f'{prefix}/{dir_name}'

# List items in the directory
Expand All @@ -374,7 +373,8 @@ def build_directory_tree(path, prefix='', is_root=True, ignore=None):
output += '\n'
for index, dir_item in enumerate(dirs):
item_path = os.path.join(path, dir_item)
output += build_directory_tree(item_path, prefix + indent, is_root=False, ignore=ignore)
new_prefix = prefix + indent # Updated prefix for recursion
output += build_directory_tree(item_path, new_prefix, is_root=False, ignore=ignore)

if files:
output += f"{prefix} {', '.join(files)}\n"
Expand Down

0 comments on commit ab550ca

Please sign in to comment.