Skip to content

Commit

Permalink
Autocomplete to use only the basename of the path
Browse files Browse the repository at this point in the history
  • Loading branch information
academo committed Aug 25, 2021
1 parent 30cc684 commit a400db8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/git.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path
import subprocess

Expand Down Expand Up @@ -25,10 +26,9 @@ def get_worktree_list_flat(incomplete=""):
try:
worktrees = get_worktree_list()
for tree in worktrees:
if not incomplete or (
incomplete and tree["worktree"].startswith(incomplete)
):
final.append(tree["worktree"])
name = os.path.basename(tree["worktree"])
if not incomplete or (incomplete and name.startswith(incomplete)):
final.append(name)
except ValueError:
pass

Expand Down

0 comments on commit a400db8

Please sign in to comment.