We have a wrapper script around terraform and it would be nice to be able to profit from the completion available for the wrapped command.
What we currently do:
arg "<layer>" help="Layer to run"
arg "<command>" var=#true help="Terraform command to run"
complete "command" descriptions=#true run=#"terraform -help 2>&1 | awk '/^ [a-z]/ {cmd=$1; $1=""; sub(/^ +/,""); print cmd":"$0}'"#
It would be nice if the completion could not require awk and support further stuff like terraform plan -o completing to -out.
To demonstrate what would need to happen technically (with fish as an example):
arg "<layer>" help="Layer to run"
arg "<command>" var=#true help="Terraform command to run"
complete "command" descriptions=#true run=#"fish -c 'complete -C "terraform {{words[CURRENT]}"'"#
// The `words[CURRENT]` is not really correct, as we need all the words that belong to the `command` arg for this to work properly.
// (I don't know if that is currently possible)
As usage already must be aware of all the completion frameworks it supports, I feel like handing that over would be natural.
I am not sure that the arg var=#true style to model this situation is the best way to support this new functionality. I just chose this to bring the point across.
We have a wrapper script around
terraformand it would be nice to be able to profit from the completion available for the wrapped command.What we currently do:
It would be nice if the completion could not require
awkand support further stuff liketerraform plan -ocompleting to-out.To demonstrate what would need to happen technically (with fish as an example):
As
usagealready must be aware of all the completion frameworks it supports, I feel like handing that over would be natural.I am not sure that the
arg var=#truestyle to model this situation is the best way to support this new functionality. I just chose this to bring the point across.