# Path: aeriscloud/cli/helpers.py
# def standard_options(multiple=False, start_prompt=True):
#     """
#     Add the standard --project and --box options to a command
#     :param multiple: Whether to find a single or multiple boxes
#     :param start_prompt: When using single boxes, ask the user to start it if
#                          offline
#     """
#     if multiple:
#         return _multi_box_decorator
#     else:
#         return _single_box_decorator(start_prompt)
# 
# 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)


import click
import sys
from aeriscloud.cli.helpers import standard_options, Command


def sync(box, direction):
    if not box.project.rsync_enabled():
        return None

    if direction == 'down':
        click.secho('Syncing files down from the box...',
                    fg='cyan', bold=True)
        if box.rsync_down():
            click.secho('Sync down done!', fg='green', bold=True)
        else:
            click.secho('Sync down failed!', fg='red', bold=True)
            return False
    elif direction == 'up':
        click.secho('Syncing files up to the box...',
                    fg='cyan', bold=True)
        if box.rsync_up():
            click.secho('Sync up done!', fg='green', bold=True)
        else:
            click.secho('Sync up failed!', fg='red', bold=True)
            return False
    else:
        click.secho('error: invalid direction %s' % direction,
                    fg='red', bold=True)
        return False

    return True



# Path: aeriscloud/cli/helpers.py
# def standard_options(multiple=False, start_prompt=True):
#     """
#     Add the standard --project and --box options to a command
#     :param multiple: Whether to find a single or multiple boxes
#     :param start_prompt: When using single boxes, ask the user to start it if
#                          offline
#     """
#     if multiple:
#         return _multi_box_decorator
#     else:
#         return _single_box_decorator(start_prompt)
# 
# 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)


# Path: aeriscloud/cli/aeris/sync.py
import click
import sys
from aeriscloud.cli.helpers import standard_options, Command



def sync(box, direction):
    if not box.project.rsync_enabled():
        return None

    if direction == 'down':
        click.secho('Syncing files down from the box...',
                    fg='cyan', bold=True)
        if box.rsync_down():
            click.secho('Sync down done!', fg='green', bold=True)
        else:
            click.secho('Sync down failed!', fg='red', bold=True)
            return False
    elif direction == 'up':
        click.secho('Syncing files up to the box...',
                    fg='cyan', bold=True)
        if box.rsync_up():
            click.secho('Sync up done!', fg='green', bold=True)
        else:
            click.secho('Sync up failed!', fg='red', bold=True)
            return False
    else:
        click.secho('error: invalid direction %s' % direction,
                    fg='red', bold=True)
        return False

    return True



@click.command(cls=Command)