parameters: (keyList,indent,oneColumn)
docstring: Print list of strings in columns
      - blue for directories
      - green for trees
docstring_summary: Print list of strings in columns
      - blue for directories
      - green for trees
docstring_tokens: Print list of strings in columns - blue for directories - green for trees
function: def _rootLsPrintSimpleLs(keyList,indent,oneColumn):
      """Print list of strings in columns
      - blue for directories
      - green for trees"""
      # This code is adapted from the pprint_list function here :
      # http://stackoverflow.com/questions/25026556/output-list-like-ls
      # Thanks hawkjo !!
      if len(keyList) == 0: return
      (term_width, term_height) = getTerminalSize()
      term_width = term_width - indent
      min_chars_between = 2
      min_element_width = min( len(key.GetName()) for key in keyList ) \
                          + min_chars_between
      max_element_width = max( len(key.GetName()) for key in keyList ) \
                          + min_chars_between
      if max_element_width >= term_width: ncol,col_widths = 1,[1]
      else:
          # Start with max possible number of columns and reduce until it fits
          ncol = 1 if oneColumn else min( len(keyList), term_width // min_element_width  )
          while True:
              col_widths = \
                  [ max( len(key.GetName()) + min_chars_between \
                  for j, key in enumerate(keyList) if j % ncol == i ) \
                  for i in range(ncol) ]
              if sum( col_widths ) <= term_width: break
              else: ncol -= 1
  
      for i, key in enumerate(keyList):
          if i%ncol == 0: write("",indent) # indentation
          # Don't add spaces after the last element of the line or of the list
          if (i+1)%ncol != 0 and i != len(keyList)-1:
              if not IS_TERMINAL: write( \
                  key.GetName().ljust(col_widths[i%ncol]))
              elif isDirectoryKey(keyList[i]): write( \
                  isSpecial(ANSI_BLUE,key.GetName()).ljust( \
                      col_widths[i%ncol] + ANSI_BLUE_LENGTH))
              elif isTreeKey(keyList[i]): write( \
                  isSpecial(ANSI_GREEN,key.GetName()).ljust( \
                      col_widths[i%ncol] + ANSI_GREEN_LENGTH))
              else: write(key.GetName().ljust(col_widths[i%ncol]))
          else: # No spaces after the last element of the line or of the list
              if not IS_TERMINAL: write(key.GetName())
              elif isDirectoryKey(keyList[i]):
                  write(isSpecial(ANSI_BLUE, key.GetName()))
              elif isTreeKey(keyList[i]):
                  write(isSpecial(ANSI_GREEN, key.GetName()))
              else: write(key.GetName())
              write('\n')
function_tokens: def _rootLsPrintSimpleLs ( keyList , indent , oneColumn ) : # This code is adapted from the pprint_list function here : # http://stackoverflow.com/questions/25026556/output-list-like-ls # Thanks hawkjo !! if len ( keyList ) == 0 : return ( term_width , term_height ) = getTerminalSize ( ) term_width = term_width - indent min_chars_between = 2 min_element_width = min ( len ( key . GetName ( ) ) for key in keyList ) + min_chars_between max_element_width = max ( len ( key . GetName ( ) ) for key in keyList ) + min_chars_between if max_element_width >= term_width : ncol , col_widths = 1 , [ 1 ] else : # Start with max possible number of columns and reduce until it fits ncol = 1 if oneColumn else min ( len ( keyList ) , term_width // min_element_width ) while True : col_widths = [ max ( len ( key . GetName ( ) ) + min_chars_between for j , key in enumerate ( keyList ) if j % ncol == i ) for i in range ( ncol ) ] if sum ( col_widths ) <= term_width : break else : ncol -= 1 for i , key in enumerate ( keyList ) : if i % ncol == 0 : write ( "" , indent ) # indentation # Don't add spaces after the last element of the line or of the list if ( i + 1 ) % ncol != 0 and i != len ( keyList ) - 1 : if not IS_TERMINAL : write ( key . GetName ( ) . ljust ( col_widths [ i % ncol ] ) ) elif isDirectoryKey ( keyList [ i ] ) : write ( isSpecial ( ANSI_BLUE , key . GetName ( ) ) . ljust ( col_widths [ i % ncol ] + ANSI_BLUE_LENGTH ) ) elif isTreeKey ( keyList [ i ] ) : write ( isSpecial ( ANSI_GREEN , key . GetName ( ) ) . ljust ( col_widths [ i % ncol ] + ANSI_GREEN_LENGTH ) ) else : write ( key . GetName ( ) . ljust ( col_widths [ i % ncol ] ) ) else : # No spaces after the last element of the line or of the list if not IS_TERMINAL : write ( key . GetName ( ) ) elif isDirectoryKey ( keyList [ i ] ) : write ( isSpecial ( ANSI_BLUE , key . GetName ( ) ) ) elif isTreeKey ( keyList [ i ] ) : write ( isSpecial ( ANSI_GREEN , key . GetName ( ) ) ) else : write ( key . GetName ( ) ) write ( '\n' )