~ser/claptrap#1: 
Improve autocomplete

claptrap's json dump with CLAPTRAP_USAGE_JSON is context sensitive; that is:

$ CLAPTRAP_USAGE_JSON=true <program>

will output the entire tree, whereas:

$ CLAPTRAP_USAGE_JSON=true <program> <command>

will dump the subtree for <command>. It should therefore be possible to make _clapcomplete_ work on the first subcommand level by generating WORDS with:

local WORDS=($(CLAPTRAP_USAGE_JSON=true $1 $2 | jq -r "$JQR"))

This needs to be dynamic, of course; COMP_CWORD holds the number of arguments being passed in, but (at this moment) that exhausts my knowledge of the autocomplete mechanism.

I would love if someone donated a patch for this.

Status
REPORTED
Submitter
~ser
Assigned to
No-one
Submitted
1 year, 8 months ago
Updated
1 year, 8 months ago
Labels
feature