# Path: aeriscloud/cli/helpers.py
# class Command(click.Command):
#     # This is inherited by the Context to switch between pure POSIX and
#     # argparse-like argument parsing. Setting it to false will push any
#     # unknown flag to the argument located where the flag was declared
#     allow_interspersed_args = config.get('config', 'posix', default=False)
# 
#     def __init__(self, *args, **kwargs):
#         cs = dict(help_option_names=['-h', '--help'])
#         super(Command, self).__init__(context_settings=cs,
#                                       *args, **kwargs)
# 
# def move_shell_to(path):
#     """
#     If the process is called through the function set in scripts/env.sh,
#     will move the user to the given path on successful exit
# 
#     :param path: str
#     """
#     if 'AERIS_CD_TMP_FILE' in os.environ:
#         with open(os.environ['AERIS_CD_TMP_FILE'], 'w') as f:
#             f.write(path)
# 
# Path: aeriscloud/config.py
# def projects_path():
#     return config.get('config', 'projects_path', default=None)
# 
# 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


import click
import errno
import sys
from aeriscloud.cli.helpers import Command, move_shell_to
from aeriscloud.config import projects_path
from aeriscloud.project import get
#!/usr/bin/env python




@click.command(cls=Command)
@click.argument('project', required=False)
def cli(project):
    """
    Goto a project's directory
    """
    if not project:
        move_shell_to(projects_path())
        return


# Path: aeriscloud/cli/helpers.py
# class Command(click.Command):
#     # This is inherited by the Context to switch between pure POSIX and
#     # argparse-like argument parsing. Setting it to false will push any
#     # unknown flag to the argument located where the flag was declared
#     allow_interspersed_args = config.get('config', 'posix', default=False)
# 
#     def __init__(self, *args, **kwargs):
#         cs = dict(help_option_names=['-h', '--help'])
#         super(Command, self).__init__(context_settings=cs,
#                                       *args, **kwargs)
# 
# def move_shell_to(path):
#     """
#     If the process is called through the function set in scripts/env.sh,
#     will move the user to the given path on successful exit
# 
#     :param path: str
#     """
#     if 'AERIS_CD_TMP_FILE' in os.environ:
#         with open(os.environ['AERIS_CD_TMP_FILE'], 'w') as f:
#             f.write(path)
# 
# Path: aeriscloud/config.py
# def projects_path():
#     return config.get('config', 'projects_path', default=None)
# 
# 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


# Path: aeriscloud/cli/aeris/goto.py
import click
import errno
import sys
from aeriscloud.cli.helpers import Command, move_shell_to
from aeriscloud.config import projects_path
from aeriscloud.project import get

#!/usr/bin/env python




@click.command(cls=Command)
@click.argument('project', required=False)
def cli(project):
    """
    Goto a project's directory
    """
    if not project:
        move_shell_to(projects_path())
        return


    pro = get(project)