# Path: elevator/utils/patterns.py
# def destructurate(container):
#     try:
#         return container[0], container[1:]
#     except (KeyError, AttributeError):
#         raise DestructurationError("Can't destructurate a non-sequence container")
# 
# Path: elevator_cli/helpers.py
# def fail(type, msg):
# def success(datas):


import shlex
from clint.textui import puts, colored
from elevator.utils.patterns import destructurate
from .helpers import FAILURE_STATUS

# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.






def prompt(*args, **kwargs):
    current_db = kwargs.pop('current_db', 'default')

    if current_db:
        pattern = '@ Elevator.{db} => '.format(db=current_db)
    else:
        pattern = '! Offline => '
    input_str = raw_input(pattern)

    return input_str


def parse_input(input_str, *args, **kwargs):
    input_str = shlex.split(input_str.strip())
    command, args = destructurate(input_str)
    return command.upper(), args


def output_result(status, result, *args, **kwargs):
    if result:

# Path: elevator/utils/patterns.py
# def destructurate(container):
#     try:
#         return container[0], container[1:]
#     except (KeyError, AttributeError):
#         raise DestructurationError("Can't destructurate a non-sequence container")
# 
# Path: elevator_cli/helpers.py
# def fail(type, msg):
# def success(datas):


# Path: elevator_cli/io.py
import shlex
from clint.textui import puts, colored
from elevator.utils.patterns import destructurate
from .helpers import FAILURE_STATUS


# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.






def prompt(*args, **kwargs):
    current_db = kwargs.pop('current_db', 'default')

    if current_db:
        pattern = '@ Elevator.{db} => '.format(db=current_db)
    else:
        pattern = '! Offline => '
    input_str = raw_input(pattern)

    return input_str


def parse_input(input_str, *args, **kwargs):
    input_str = shlex.split(input_str.strip())
    command, args = destructurate(input_str)
    return command.upper(), args


def output_result(status, result, *args, **kwargs):
    if result:

        if status == FAILURE_STATUS: