================= TODO: optcomplete ================= - IMPORTANT: if the option is a store option and takes e.g. an int or a float, override the default completion to not list the files. - bug: we need a better way to pass the COMP_WORDS array to the program, lest the space delimited arguments will be split (bleh). perhaps use a random string to do this. - provide more completers. - Add this contribution from Mark Eichin : Was experimenting with optcomplete (1.2 from debian) and noticed that the default completer *only* worked on local files, unlike the way bash completion works without a hook. This wasn't to hard to change with an explicit FileCompleter:: # we don't need state, so make it a function... def FileCompleter(pwd, line, point, prefix, suffix ): """Completes by listing all possible files, here or matching substrings""" startdir = os.path.dirname(prefix) lhs = os.path.basename(prefix) if not startdir: startdir = pwd return [os.path.join(startdir, f) for f in os.listdir(startdir) if f.startswith(lhs)] .. end - how will it work with my multiple subcommand framework? - see if we can support csh. - we could add an option that would make the short options automatically expand to long options, this depends how the shell treats our answers. - optcomplete: write and publish the insight document about optcomplete, with 3 volets: 1. documentation, in file 2. options parsing and help 3. graying/filter vs. programmable completion - Unix has had the great tradition of the command-line interface (note: just another interface); - this has nurtured an environment where genericity has been given importance, and incidentally, modularity. these conditions make for software that is more robust: there is more reuse since the functionality is more generic, and modularity forces the programmer to have to deal with interfaces, which in turn indices the need for better design and thinking of the code. - Reported by Graham Davies:: the module gives exactly the same symptoms as the regular bash completion code (not that surprising). These do NOT work as expected: :work[tab] p:work =work p=work etc. However, these all work fine with or without the prefix 'p': @work p-work p+work p%work p_work p^work p[work p]work p{work p}work p?work Can you envision a fix for this - or are the : and = symbols fundamental to bash completion?