#NEWLINE# def complete( self , tokens , **kwargs ) : #NEWLINE# #INDENT# 'Completion handler; designed to work for shell auto-completion.\n\n        Takens in a list of tokens (that may need to be split up into\n        individual tokens) and assumes it is the start of a command the user\n        tries to type. The method then returns a list of words that would\n        complete the last token the user is currently trying to complete.\n        ' #NEWLINE# args = [ ] #NEWLINE# for token in tokens : #NEWLINE# #INDENT# args += [ x for x in token . split ( ' ' ) if ( not x . startswith ( '-' ) ) ] #NEWLINE# #UNINDENT# choices = ( AVAILABLE_MAESTRO_COMMANDS if ( len ( args ) <= 2 ) else ( self . services . keys ( ) + self . containers . keys ( ) ) ) #NEWLINE# prefix = '' #NEWLINE# if ( len ( args ) == 2 ) : #NEWLINE# #INDENT# prefix = args [ 1 ] #NEWLINE# if ( prefix in choices ) : #NEWLINE# #INDENT# args . append ( '' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( args ) > 2 ) : #NEWLINE# #INDENT# prefix = args . pop ( ) #NEWLINE# #UNINDENT# print ( ' ' . join ( filter ( ( lambda x : x . startswith ( prefix ) ) , set ( prefix ) ) ) )