(self, edit, toggle=False)
toggle  if True, state of directory(s) will be toggled (i.e. expand/collapse)
toggle  if True, state of directory(s) will be toggled (i.e. expand/collapse)
toggle if True state of directory ( s ) will be toggled ( i . e . expand / collapse )
def run(self, edit, toggle=False):
        '''
        toggle  if True, state of directory(s) will be toggled (i.e. expand/collapse)
        '''
        self.index = self.get_all()
        filenames = self.get_marked(full=True) or self.get_selected(parent=False, full=True)

        if len(filenames) == 1 and filenames[0][~0] == os.sep:
            return self.expand_single_directory(edit, filenames[0], toggle)
        elif filenames:
            # working with several selections at once is very tricky, thus for reliability we should
            # recreate the entire tree, despite it is supposedly slower, but not really, because
            # one view.replace/insert() call is faster than multiple ones
            self.view.run_command('dired_refresh', {'to_expand': filenames, 'toggle': toggle})
            return
        else:
            return sublime.status_message('Item cannot be expanded')
def run ( self , edit , toggle = False ) : self . index = self . get_all ( ) filenames = self . get_marked ( full = True ) or self . get_selected ( parent = False , full = True ) if len ( filenames ) == 1 and filenames [ 0 ] [ ~ 0 ] == os . sep : return self . expand_single_directory ( edit , filenames [ 0 ] , toggle ) elif filenames : # working with several selections at once is very tricky, thus for reliability we should # recreate the entire tree, despite it is supposedly slower, but not really, because # one view.replace/insert() call is faster than multiple ones self . view . run_command ( 'dired_refresh' , { 'to_expand' : filenames , 'toggle' : toggle } ) return else : return sublime . status_message ( 'Item cannot be expanded' )