# Path: servi/command.py
# class Command(object):
#     def __init__(self):
#         self.special = {
#             "skip_init": False,
#             "parse_known_args": False
#         }
# 
#     def register_command_line(self, sub_parser):
#         pass
# 
#     def run(self, args, extra_args):
#         pass
# 
# Path: servi/utils.py
# @contextmanager
# def timeit():
#     t0 = datetime.now()
#     yield
#     t1 = datetime.now()
#     info('Total running time: {0:.1f} min'.format((t1 - t0).seconds / 60))
# 
# Path: servi/exceptions.py
# class ServiError(Exception):
#     # Expected errrors. Handle gracefully (ie: no stack dump)
#     def __init__(self, msg=None):
#         self.msg = msg
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             '{0}\n'
#             '\n**Servi Aborting**'.format(self.msg))


import subprocess
import os
import sys
import servi.config as c
from logging import info
from servi.command import Command
from servi.utils import timeit
from servi.exceptions import ServiError
        servi_inventory = \
            subprocess.check_output('which servi_inventory', shell=True,
                                    universal_newlines=True)
    except subprocess.CalledProcessError:
        raise ServiError("Couldn't find servi_inventory script on path.\n"
                         "Try 'which servi_inventory'.\n"
                         "Current path: {0}".format(sys.path))
    servi_inventory = servi_inventory.strip()

    return servi_inventory


class LansCommand(Command):
    def __init__(self):
        super().__init__()
        self.special = {"parse_known_args": True}

    def register_command_line(self, sub_parsers):

        parser = sub_parsers.add_parser(
            'lans', help="Local ANSible - "
                         "Run ansbile on your local (vagrant) setup.",
            description="Local ANSible - "
                        "Run ansbile on your local (vagrant) setup."
                        "This is a convenience function that sets "
                        "up the ansible command with the proper "
                        "vagrant_inventory "
                        "file, and ssh user and password, saving you a lot "
                        "of typing. Any arguments not listed below will be "
                        "passed directly 'ansible-playbook'."

# Path: servi/command.py
# class Command(object):
#     def __init__(self):
#         self.special = {
#             "skip_init": False,
#             "parse_known_args": False
#         }
# 
#     def register_command_line(self, sub_parser):
#         pass
# 
#     def run(self, args, extra_args):
#         pass
# 
# Path: servi/utils.py
# @contextmanager
# def timeit():
#     t0 = datetime.now()
#     yield
#     t1 = datetime.now()
#     info('Total running time: {0:.1f} min'.format((t1 - t0).seconds / 60))
# 
# Path: servi/exceptions.py
# class ServiError(Exception):
#     # Expected errrors. Handle gracefully (ie: no stack dump)
#     def __init__(self, msg=None):
#         self.msg = msg
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             '{0}\n'
#             '\n**Servi Aborting**'.format(self.msg))


# Path: servi/commands/lans.py
import subprocess
import os
import sys
import servi.config as c
from logging import info
from servi.command import Command
from servi.utils import timeit
from servi.exceptions import ServiError

        servi_inventory = \
            subprocess.check_output('which servi_inventory', shell=True,
                                    universal_newlines=True)
    except subprocess.CalledProcessError:
        raise ServiError("Couldn't find servi_inventory script on path.\n"
                         "Try 'which servi_inventory'.\n"
                         "Current path: {0}".format(sys.path))
    servi_inventory = servi_inventory.strip()

    return servi_inventory


class LansCommand(Command):
    def __init__(self):
        super().__init__()
        self.special = {"parse_known_args": True}

    def register_command_line(self, sub_parsers):

        parser = sub_parsers.add_parser(
            'lans', help="Local ANSible - "
                         "Run ansbile on your local (vagrant) setup.",
            description="Local ANSible - "
                        "Run ansbile on your local (vagrant) setup."
                        "This is a convenience function that sets "
                        "up the ansible command with the proper "
                        "vagrant_inventory "
                        "file, and ssh user and password, saving you a lot "
                        "of typing. Any arguments not listed below will be "
                        "passed directly 'ansible-playbook'."

        )