Hi All,

Please can anyone help me in resolving following problem.

import cmd
class CmdLineApp(cmd.Cmd):

        def do_grep(self, line):
                print line

        option = ["--ignore-case",
"--invert-match","--word-regexp","--line-regexp"]
        def complete_grep(self, text, line, begidx, endidx):
                return [i for i in CmdLineApp.option if i.startswith(text)]

interpreter = CmdLineApp()
interpreter.cmdloop()

In above program I want to do command line completion (or tab completion).
If the elements of option list starts with special character such as
'-', '@', '#', '--' , then it is giving me output like

(Cmd) grep
grep
(Cmd) grep ------

instead of

(Cmd) grep --
--ignore-case  --invert-match  --word-regexp  --line-regexp

How I can handle this special characters?


Thanks & Regards
Rajshree Thorat
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to