Skip to content

Commit ebe8873

Browse files
committed
Fixed path completion case where cwd is just a slash
1 parent f3b9a35 commit ebe8873

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd2/cmd2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,11 @@ def complete_users() -> List[str]:
11411141

11421142
# Remove cwd if it was added to match the text readline expects
11431143
if cwd_added:
1144-
matches = [cur_path.replace(cwd + os.path.sep, '', 1) for cur_path in matches]
1144+
if cwd == os.path.sep:
1145+
to_replace = cwd
1146+
else:
1147+
to_replace = cwd + os.path.sep
1148+
matches = [cur_path.replace(to_replace, '', 1) for cur_path in matches]
11451149

11461150
# Restore the tilde string if we expanded one to match the text readline expects
11471151
if expanded_tilde_path:

0 commit comments

Comments
 (0)