# Path: aeriscloud/config.py
# def module_path():
#     def __init__(self):
#     def load(self):
#     def has(self, section, option):
#     def get(self, section, option, **kwargs):
#     def set(self, section, option, value):
#     def unset(self, section, option):
#     def save(self):
#     def dump(self):
#     def complete(self):
# def inventory_path():
# def config_dir():
# def data_dir():
# def config_ini_path():
# def projects_path():
# def basebox_bucket():
# def default_organization():
# def expose_username():
# def expose_url():
# def has_github_integration():
# def verbosity(val=None):
# class Config(object):
# 
# Path: aeriscloud/ansible.py
# def get_env_path(organization):
#     return os.path.join(organization_path, organization)
# 
# Path: aeriscloud/project.py
# def get(name):
#     """
#     Return the project corresponding to the given project name or directory
# 
#     :param name: str
#     :return: Project|None
#     """
#     project_list = projects()
#     if name in project_list:
#         return project_list[name]
#     if os.path.isdir(os.path.join(projects_path(), name)):
#         return Project(os.path.join(projects_path(), name))
#     return None
# 
# def from_cwd():
#     path = os.getcwd()
#     pro_path = projects_path()
# 
#     # walk path upward until we find a .aeriscloud.yml file or until we
#     # reach the project folder
#     while True:
#         pro = from_path(path)
# 
#         if pro:
#             return pro
# 
#         if path == pro_path or not path.startswith(pro_path):
#             break
# 
#         path = os.path.dirname(path)
# 
#     return None


import os
import re
import sys
from aeriscloud.config import projects_path, aeriscloud_path,\
    data_dir, config_dir
from aeriscloud.ansible import get_env_path
from aeriscloud.project import get, from_cwd
        from aeriscloud.ansible import get_inventory_list
        from aeriscloud.ansible import inventory_path
        from aeriscloud.ansible import get_organization_list
        from aeriscloud.ansible import get_env_path, get_organization_list
        from aeriscloud.ansible import Inventory, get_inventory_file
        from aeriscloud.ansible import Inventory, get_inventory_file
        from slugify import slugify
    from aeriscloud.ansible import get_organization_list


def _print_param(param, project_name=None, box_name=None):  # noqa
    """
    Completes subcommands parameters
    """
    if param == 'job':
        job_cache_file = os.path.join(data_dir(), 'jobs-cache')
        if not os.path.exists(job_cache_file):
            return
        with open(job_cache_file) as fd:
            jobs = [line for line in fd.read().split('\n') if line.strip()]
            print(' '.join(jobs))
    elif param == 'inventory':

        print(' '.join([
            inventory[1]
            for inventory in get_inventory_list()
        ]))
    elif param == 'inventory_name':

        print(' '.join([inventory_dir
                        for inventory_dir in os.listdir(inventory_path)
                        if inventory_dir[0] != '.']))
    elif param == 'organization_name':
        print(' '.join(get_organization_list()))
    elif param == 'env':
        for organization in get_organization_list():
            print(' '.join([organization + '/' + job_file[4:-4]
                            for job_file

# Path: aeriscloud/config.py
# def module_path():
#     def __init__(self):
#     def load(self):
#     def has(self, section, option):
#     def get(self, section, option, **kwargs):
#     def set(self, section, option, value):
#     def unset(self, section, option):
#     def save(self):
#     def dump(self):
#     def complete(self):
# def inventory_path():
# def config_dir():
# def data_dir():
# def config_ini_path():
# def projects_path():
# def basebox_bucket():
# def default_organization():
# def expose_username():
# def expose_url():
# def has_github_integration():
# def verbosity(val=None):
# class Config(object):
# 
# Path: aeriscloud/ansible.py
# def get_env_path(organization):
#     return os.path.join(organization_path, organization)
# 
# Path: aeriscloud/project.py
# def get(name):
#     """
#     Return the project corresponding to the given project name or directory
# 
#     :param name: str
#     :return: Project|None
#     """
#     project_list = projects()
#     if name in project_list:
#         return project_list[name]
#     if os.path.isdir(os.path.join(projects_path(), name)):
#         return Project(os.path.join(projects_path(), name))
#     return None
# 
# def from_cwd():
#     path = os.getcwd()
#     pro_path = projects_path()
# 
#     # walk path upward until we find a .aeriscloud.yml file or until we
#     # reach the project folder
#     while True:
#         pro = from_path(path)
# 
#         if pro:
#             return pro
# 
#         if path == pro_path or not path.startswith(pro_path):
#             break
# 
#         path = os.path.dirname(path)
# 
#     return None


# Path: aeriscloud/cli/complete.py
import os
import re
import sys
from aeriscloud.config import projects_path, aeriscloud_path,\
    data_dir, config_dir
from aeriscloud.ansible import get_env_path
from aeriscloud.project import get, from_cwd
        from aeriscloud.ansible import get_inventory_list
        from aeriscloud.ansible import inventory_path
        from aeriscloud.ansible import get_organization_list
        from aeriscloud.ansible import get_env_path, get_organization_list
        from aeriscloud.ansible import Inventory, get_inventory_file
        from aeriscloud.ansible import Inventory, get_inventory_file
        from slugify import slugify
    from aeriscloud.ansible import get_organization_list



def _print_param(param, project_name=None, box_name=None):  # noqa
    """
    Completes subcommands parameters
    """
    if param == 'job':
        job_cache_file = os.path.join(data_dir(), 'jobs-cache')
        if not os.path.exists(job_cache_file):
            return
        with open(job_cache_file) as fd:
            jobs = [line for line in fd.read().split('\n') if line.strip()]
            print(' '.join(jobs))
    elif param == 'inventory':

        print(' '.join([
            inventory[1]
            for inventory in get_inventory_list()
        ]))
    elif param == 'inventory_name':

        print(' '.join([inventory_dir
                        for inventory_dir in os.listdir(inventory_path)
                        if inventory_dir[0] != '.']))
    elif param == 'organization_name':
        print(' '.join(get_organization_list()))
    elif param == 'env':
        for organization in get_organization_list():
            print(' '.join([organization + '/' + job_file[4:-4]
                            for job_file

                            in os.listdir(get_env_path(organization))