little-dude
little-dude

Reputation: 1674

Cmd module : having completion on the first word

I use completedefault (see the doc) for completion with Cmd module. But it seems to be called only after the first word.

def completedefault(self,text,line,begidx,endidx):                                          
     print('completedefault is called')                                                      
     return ['foo','bar']

Output :

(Cmd) f<Tab><Tab>
(Cmd) foo f<Tab><Tab>
completedefault is called
foo bar

How to change this behavior to have it called even on the first word ?

Upvotes: 4

Views: 217

Answers (1)

little-dude
little-dude

Reputation: 1674

The answer is actually simple : Cmd.completenames. More info here. A similar question here.

Upvotes: 2

Related Questions