mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 02:55:15 +00:00
Base: Add completion for cd that suggests only directories
This commit is contained in:
parent
785f95d0af
commit
66955b82a7
|
@ -74,3 +74,17 @@ _complete_kill() {
|
|||
__complete_job_spec $*[-1]
|
||||
}
|
||||
}
|
||||
|
||||
_complete_cd() {
|
||||
if test $*[-1] = '--' {
|
||||
invariant_offset=0
|
||||
results=${concat_lists .*/ */}
|
||||
} else {
|
||||
invariant_offset=${length "$*[-1]"}
|
||||
results=$(glob "$*[-1]*/")
|
||||
}
|
||||
|
||||
for $results {
|
||||
echo '{"kind":"plain","static_offset":0,"invariant_offset":'"$invariant_offset"',"completion":"'"${remove_suffix / $it}"'","trailing_trivia":"/"}'
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue