-
-
Notifications
You must be signed in to change notification settings - Fork 163
Shellac Protocol Proposal V2
andychu edited this page Sep 22, 2019
·
8 revisions
- Back to Shell Autocompletion
- Original Shellac Protocol Proposal
- Shell-agnostic. You can't force zsh to parse bash strings!
- Compatible with existing completion scripts. e.g.
_openstack
use case. Most migrations should be a trivial wrapper. - Probably: Should be implementable in pure bash and zsh.
Compared to the original Shellac Protocol Proposal
- Remove mention of coprocesses! That is orthogonal. It's just a process now.
- Input side:
- shellac-provider -- command --myflag 1 --myflag2 f
- Output:
- { key, value, key, value } in NUL terminated strings
- Arrays are prefixed with length
Example:
["candidates", "2", "one", "two", "descriptions", "2", "desc1", "desc2"]
This is printed on stdout as a series of NUL-terminated strings.
- Read with
read -d $'\0'
in bash
Look in $SHELLAC_HOME_DIR/plugins/openstack/complete
for openstack.
$SHELLAC_HOME
= ~/.local/shellac
on Linux.
TODO: details.
- Input format is extensible with new flags
- Output format is extensible with new "keys".
- right now we have
"candidates"
and"descriptions"
, but we can have more.
- right now we have
- Easy, just take COMPREPLY and print as "candidates". Descriptions are left blank.
- Easy, just write a shell wrapper:
#!/bin/sh
exec npm complete "$@"
- line-oriented protocol
- COMP_CWORDS is wrong
TODO: Write up more!
See Shellac Test Cases.