Skip to content
andychu edited this page May 23, 2019 · 4 revisions

Shellac clients are typically shells. They should handle dequoting / "static" evaluation of the command string into a partial argv array, so that the completion plugin doesn't need to parse shell. The completion plugin is only responsible for understanding the argv array.

Here are some important cases for POSIX shells. Obviously, alternative shells like fish will have their own dequoting / evaluation rules.

ls | wc -<TAB>
echo hi && wc -l<TAB>
echo $(dirname f<TAB>
echo `dirname f<TAB>

Those should get expanded into:

["wc", "-"]   # lines 1 and 2
["dirname", "f"]   # lines 3 and 4

The rest of the command line is considered irrelevant for completion. All shell operators should be removed.

Quoting:

echo 'filename with spac<TAB>
echo filename\ with\ spac<TAB>

Should be expanded to:

["echo", "filename with spac"]  # dequoted partial argv
Clone this wiki locally