I tried to pack the issue into the subject. Further explanation:
Imagine a ConfigNode class that has a ui_command_charges() method.
Imagine there's a corresponding ui_complete_charges() method with code like this:
~~~ def ui_complete_charges(self, parameters, text, current_param): if current_param == 'month': L = map(str, range(-12, 13)) L.insert(0, '-24') completions = [a for a in L if a.startswith(text)] else: completions = [] return completions ~~~
So the goal here is to have tab-completion for this "month" option with potential args starting at -24, followed by -12 to 12 (inclusive). I mean, the numbers are in a list in that order, after all. Instead, the following makes it clear that ConfigShell is doing some sorting on the list my method generates:
~~~ /billing> charges month= -1 -3 -9 2 8 -10 -4 0 3 9 -11 -5 1 4 -12 -6 10 5 -2 -7 11 6 -24 -8 12 7 ....................................month /billing> charges month= ~~~
For the record, this is just one example. I've noticed this multiple times -- I'm curious to know if this is a bug or a feature. (Perhaps simply a side-effect of implementation?)
I spent a little while looking at the completion code -- ConfigShell._complete_*() and ConfigShell._dispatch_completion(), AFAICT -- but honestly ... it's above my pay grade right now. 10 minutes with it was enough to make me want to subscribe and ask you all about this.
So ... bug? If not, I'd love any pointers on how I could change this behavior on my own.
Thanks for reading.