Closed aryarm closed 6 years ago
$COMP_WORDS
to check whether the first argument to cds
is -
$COMP_WORDS
to get a sub-array of all of the shortcut names to be deletedcds - <letter(s)>[tab] <shortcut2>
)Turns out that removing shortcut names that have already been typed from the completions is harder than I thought, especially because bash doesn't have an elegant way of checking whether an element exists in an array. My final attempt was on commit a4d27f6bfc94fa4593c0757da4e40d960ca8f3c4 but then I gave up and put everything back to normal in commit cc444c29f4c455d708af3e9a9d18e9aefd458ecf. I might come back to this later, but it seems like code for _cds will be significantly more simple if this feature isn't implemented.
You can pass more than one shortcut name to
cds -
to delete multiple shortcuts at a time (ex:cds - <shortcut1> <shortcut2>
.When tab completing
cds -
, only the first shortcut gets completions._cds
is not prepared to handle tab completions forcds -
with an arbitrary number of shortcuts to be deleted. So completions forcds - <letter(s)>[tab]
works but those forcds - <shortcut1> <letter(s)>[tab]
andcds - <shortcut1> <shortcut2> <letter(s)>[tab]
do not work.Also, completions should work at any point in typing the command, so
cds - <letter(s)>[tab] <shortcut2>
should also work.