Home | History | Annotate | Download | only in cr
      1 # Copyright 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """Bash auto completion support.
      6 
      7 Contains the special mode that returns lists of possible completions for the
      8 current command line.
      9 """
     10 
     11 import cr
     12 
     13 
     14 def Complete():
     15   """Attempts to build a completion list for the current command line.
     16 
     17   COMP_WORD contains the word that is being completed, and COMP_CWORD has
     18   the index of that word on the command line.
     19   """
     20 
     21   # TODO(iancottrell): support auto complete of more than just the command
     22   # try to parse the command line using parser
     23   print ' '.join(command.name for command in cr.Command.Plugins())
     24