1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: fix vcomplete for zsh (#18950)

This commit is contained in:
Turiiya 2023-07-23 12:15:23 +02:00 committed by GitHub
parent 40dc80079d
commit 15fdfd7bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,11 +342,19 @@ fn auto_complete(args []string) {
exit(0) exit(0)
} }
mut lines := []string{} mut lines := []string{}
mut dirs := []string{}
mut files := []string{}
list := auto_complete_request(sub_args[1..]) list := auto_complete_request(sub_args[1..])
for entry in list { for entry in list {
lines << 'compadd -U -S' + '""' + ' -- ' + "'${entry}';" match true {
os.is_dir(entry) { dirs << entry }
os.is_file(entry) { files << entry }
else { lines << entry }
} }
println(lines.join('\n')) }
println('compadd -q -- ${lines.join(' ')}')
println('compadd -J "dirs" -X "directory" -d -- ${dirs.join(' ')}')
println('compadd -J "files" -X "file" -f -- ${files.join(' ')}')
} }
'-h', '--help' { '-h', '--help' {
println(help_text) println(help_text)