Skip to content

Commit

Permalink
feat: Append / to completed directories
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 9, 2022
1 parent 58c9778 commit 8d348d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,9 @@ func (c *Config) targetValidArgs(
var completions []string
if err := sourceState.ForEach(func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
completion := c.DestDirAbsPath.Join(targetRelPath).String()
if _, ok := sourceStateEntry.(*chezmoi.SourceStateDir); ok {
completion += "/"
}
if strings.HasPrefix(completion, toCompleteAbsPath.String()) {
completions = append(completions, completion)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/testdata/scripts/completion_unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ reference.md
related.md
:4
-- golden/complete-target-home --
$HOME/.dir
$HOME/.dir/
$HOME/.dir/file
$HOME/.file
:4
Expand Down

0 comments on commit 8d348d1

Please sign in to comment.