def import_teamocil(sconf):
    """Return tmuxp config from a `teamocil`_ yaml config.

    .. _teamocil: https://github.com/remiprev/teamocil

    Parameters
    ----------
    sconf : dict
        python dict for session configuration

    Notes
    -----

    Todos:

    - change  'root' to a cd or start_directory
    - width in pane -> main-pain-width
    - with_env_var
    - clear
    - cmd_separator
    """

    tmuxp_config = {}

    if 'session' in sconf:
        sconf = sconf['session']

    if 'name' in sconf:
        tmuxp_config['session_name'] = sconf['name']
    else:
        tmuxp_config['session_name'] = None

    if 'root' in sconf:
        tmuxp_config['start_directory'] = sconf.pop('root')

    tmuxp_config['windows'] = []

    for w in sconf['windows']:

        windowdict = {'window_name': w['name']}

        if 'clear' in w:
            windowdict['clear'] = w['clear']

        if 'filters' in w:
            if 'before' in w['filters']:
                for b in w['filters']['before']:
                    windowdict['shell_command_before'] = w['filters']['before']
            if 'after' in w['filters']:
                for b in w['filters']['after']:
                    windowdict['shell_command_after'] = w['filters']['after']

        if 'root' in w:
            windowdict['start_directory'] = w.pop('root')

        if 'splits' in w:
            w['panes'] = w.pop('splits')

        if 'panes' in w:
            for p in w['panes']:
                if 'cmd' in p:
                    p['shell_command'] = p.pop('cmd')
                if 'width' in p:
                    # todo support for height/width
                    p.pop('width')
            windowdict['panes'] = w['panes']

        if 'layout' in w:
            windowdict['layout'] = w['layout']
        tmuxp_config['windows'].append(windowdict)

    return tmuxp_config
def import_teamocil ( sconf ) : tmuxp_config = { } if 'session' in sconf : sconf = sconf [ 'session' ] if 'name' in sconf : tmuxp_config [ 'session_name' ] = sconf [ 'name' ] else : tmuxp_config [ 'session_name' ] = None if 'root' in sconf : tmuxp_config [ 'start_directory' ] = sconf . pop ( 'root' ) tmuxp_config [ 'windows' ] = [ ] for w in sconf [ 'windows' ] : windowdict = { 'window_name' : w [ 'name' ] } if 'clear' in w : windowdict [ 'clear' ] = w [ 'clear' ] if 'filters' in w : if 'before' in w [ 'filters' ] : for b in w [ 'filters' ] [ 'before' ] : windowdict [ 'shell_command_before' ] = w [ 'filters' ] [ 'before' ] if 'after' in w [ 'filters' ] : for b in w [ 'filters' ] [ 'after' ] : windowdict [ 'shell_command_after' ] = w [ 'filters' ] [ 'after' ] if 'root' in w : windowdict [ 'start_directory' ] = w . pop ( 'root' ) if 'splits' in w : w [ 'panes' ] = w . pop ( 'splits' ) if 'panes' in w : for p in w [ 'panes' ] : if 'cmd' in p : p [ 'shell_command' ] = p . pop ( 'cmd' ) if 'width' in p : p . pop ( 'width' ) windowdict [ 'panes' ] = w [ 'panes' ] if 'layout' in w : windowdict [ 'layout' ] = w [ 'layout' ] tmuxp_config [ 'windows' ] . append ( windowdict ) return tmuxp_config
Return tmuxp config from a `teamocil`_ yaml config.

    .. _teamocil: https://github.com/remiprev/teamocil

    Parameters
    ----------
    sconf : dict
        python dict for session configuration

    Notes
    -----

    Todos:

    - change  'root' to a cd or start_directory
    - width in pane -> main-pain-width
    - with_env_var
    - clear
    - cmd_separator