List the modules loaded on the minion

    .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_modules

    Module names can be specified as globs.

    .. code-block:: bash

        salt '*' sys.list_modules 's*'

def list_modules(*args):
    '''
    List the modules loaded on the minion

    .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_modules

    Module names can be specified as globs.

    .. code-block:: bash

        salt '*' sys.list_modules 's*'

    '''
    modules = set()
    if not args:
        for func in __salt__:
            modules.add(func.split('.')[0])
        return sorted(modules)

    for module in args:
        if '*' in module:
            for func in fnmatch.filter(__salt__, module):
                modules.add(func.split('.')[0])
        else:
            for func in __salt__:
                mod_test = func.split('.')[0]
                if mod_test == module:
                    modules.add(mod_test)
    return sorted(modules)