mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Add utility function to handle the logic of whether to add a slash to the directory path.
This commit is contained in:
parent
bf827eeafd
commit
eec8fa26c8
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue