# Path: torext/errors.py
# class CommandArgumentError(TorextException):
#     pass


import sys
import inspect
import functools
import time
from .errors import CommandArgumentError
        self.has_varargs = bool(spec.varargs)
        self.has_kwargs = bool(spec.keywords)

        if func.__doc__:
            doc = func.__doc__
            if '\n' in doc:
                doc = ' '.join(i.strip() for i in doc.split('\n'))
        else:
            doc = "Command '%s' in manage script" % func.__name__
        self.doc = doc

    def parse_args(self, all_args=None):
        if all_args is not None:
            all_args = all_args[:]
        else:
            all_args = sys.argv[2:]

        _kw_pos = []
        for loop, i in enumerate(all_args):
            if i.startswith('--'):
                _kw_pos.append(loop)

        if _kw_pos:
            # Check positions
            all_args_len = len(all_args)
            _fixed_kw_pos = _kw_pos + [all_args_len]
            for loop, i in enumerate(_fixed_kw_pos):
                if i == all_args_len:
                    continue
                if _fixed_kw_pos[loop + 1] - i != 2:

# Path: torext/errors.py
# class CommandArgumentError(TorextException):
#     pass


# Path: torext/script.py
import sys
import inspect
import functools
import time
from .errors import CommandArgumentError

        self.has_varargs = bool(spec.varargs)
        self.has_kwargs = bool(spec.keywords)

        if func.__doc__:
            doc = func.__doc__
            if '\n' in doc:
                doc = ' '.join(i.strip() for i in doc.split('\n'))
        else:
            doc = "Command '%s' in manage script" % func.__name__
        self.doc = doc

    def parse_args(self, all_args=None):
        if all_args is not None:
            all_args = all_args[:]
        else:
            all_args = sys.argv[2:]

        _kw_pos = []
        for loop, i in enumerate(all_args):
            if i.startswith('--'):
                _kw_pos.append(loop)

        if _kw_pos:
            # Check positions
            all_args_len = len(all_args)
            _fixed_kw_pos = _kw_pos + [all_args_len]
            for loop, i in enumerate(_fixed_kw_pos):
                if i == all_args_len:
                    continue
                if _fixed_kw_pos[loop + 1] - i != 2:

                    raise CommandArgumentError(