Add utility function to handle the logic of whether to add a slash to the directory path.

This commit is contained in:
Eadaen1 2020-09-11 12:11:35 +01:00
parent bf827eeafd
commit eec8fa26c8

View file

@ -89,3 +89,12 @@ def _dynamically_collapsed_pwd():
0 : int(target_width) - len(truncature_char)
] + truncature_char
return full
def _add_dir_slash(cwd_dir):
"""Adds a slash to parent directory path where appropriate for aesthetics.
Currently used for cwd_dir prompt variable."""
if cwd_dir and not cwd_dir.endswith(os.path.sep):
return f"{cwd_dir}{os.path.sep}"
else:
return cwd_dir