diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 029e03d46d8..a6dc3a805e0 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -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) } diff --git a/internal/cmd/testdata/scripts/completion_unix.txt b/internal/cmd/testdata/scripts/completion_unix.txt index 89c517c8ad6..fc65224f36a 100644 --- a/internal/cmd/testdata/scripts/completion_unix.txt +++ b/internal/cmd/testdata/scripts/completion_unix.txt @@ -34,7 +34,7 @@ reference.md related.md :4 -- golden/complete-target-home -- -$HOME/.dir +$HOME/.dir/ $HOME/.dir/file $HOME/.file :4