Closed neogeographica closed 3 years ago
To try:
In the dump output for run, don't include the terminating '=' if no (consistent) value. I.e. do the same thing there as in the dump output for vals.
Now in the autocomplete script we need to let the dump output flow all the way through until COMPREPLY is finally generated before we finish munging it. Since we have IFS set to \n
we should be able to do per-element munging of COMPREPLY with sed pretty easily, like COMPREPLY=($(echo "${COMPREPLY[*]}" | sed 'some-sed-operation-here'))
(famous last words perhaps)
That being the case, one thing we need to do is add a final ""
to anything that terminates with an =
character. I.e. sed 's/^\([^=]+=\)$/\1""/'
which would turn e.g. foo=
into foo=""
.
And if this is a "run" case rather than a "vals" case, we need to pipe that into one more sed operation that will add a final =
to any non-toggle that lacks it. I.e. sed 's/^\([^+][^=]*\)$/\1=/'
In "vals" autocomplete, a placeholder foo with no value is shown like
foo
and with emptystr value likefoo=
. Which is fine but not great maybe?In "run" autocomplete they both look like
foo=
.In the actual dump-placeholders output the emptystring case is instead
foo=''
which would be ideal if that could be preserved all along the way to the actual autocomplete output.