Re: [dev] Simple shell with completion
On Wed, Oct 12, 2016 at 02:56:51PM +0000, Thomas Levine wrote:
> For my login shell, I want a sh-compatible shell with the ability to
> specify complex completions. As far as I can tell, ksh only supports
> completions by command and filename. I want to do things like this,
> in tcsh.
>
> complete {folder,refile,scan,show,next,prev} \
> 'C_AT_+*@`folders -fast -recurse | sed -e s/^/+/`@'
>
> In the context of certain MH commands, this completes words that start
> with "+" with my email folders.
>
> Is there a variant of ksh that allows this level of detail in the
> configuration of completions?
>
> If not, I think I want to write a thing that does tab completion and
> forwards input and output to a ksh subprocess. Does something like this
> exist already?
OpenBSD recently added support for custom completions to ksh(1). Don't know if
it's enough to suit your specific needs. Snippet from the man page:
> Custom completions may be configured by creating an array named
> ‘complete_command’, optionally suffixed with an argument number to complete
> only for a single argument. So defining an array named ‘complete_kill’
> provides possible completions for any argument to the kill(1) command, but
> ‘complete_kill_1’ only completes the first argument. For example, the
> following command makes ksh offer a selection of signal names for the first
> argument to kill(1):
>
> set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM
Received on Wed Oct 12 2016 - 17:16:57 CEST
This archive was generated by hypermail 2.3.0
: Wed Oct 12 2016 - 17:24:12 CEST