[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
compgen -I (programmable completion as if initial word)
From: |
Stephen Gildea |
Subject: |
compgen -I (programmable completion as if initial word) |
Date: |
Tue, 24 Sep 2024 12:15:29 -0700 |
I would like these two partially entered commands to complete the
same way:
$ ca<Tab>
$ sudo ca<Tab>
The first completion nicely takes into account any previous
"complete -I" setting (because it is completing the initial
word of a command).
But the second completion relies on a programmable completion,
and in Bash 5.2 it is hard to program the same behavior. In
particular, the programmed completion cannot easily tell Bash
to obey my -I setting.
I can get _almost_ the same effect by having the "sudo" compspec
run "compgen -c" (generate completions over command names), but
that would ignore my -I setting.
I would like to be able to say "compgen -I" in my compspec and
have Bash generate completions as if this were the initial
word of a command, applying whatever settings it would to an
actual initial word.
< Stephen
- compgen -I (programmable completion as if initial word),
Stephen Gildea <=