# Path: lib/Tools/Casify.py
# def to_dash_case(name):
#     titles = _get_words(name)
#     return "-".join(titles)
# 
# Path: lib/Tools/InstanceCollector.py
# class InstanceCollector:
#     def __init__(self, instantiate=True, *, instance_resolver=None, glob=None):
#         self.instance_resolver = instance_resolver or InstanceResolver(instantiate)
#         self.glob = glob or global_glob
# 
#     # this returns an iterator!
#     def collect(self, path):
#         for filename in self.glob.iglob(os.path.join(path, '*.py')):
#             modparts = filename.replace('/', '.').split('.')[:-1]
#             clsname = modparts[-1]
#             folder = ".".join(modparts[:-1])
#             yield self.instance_resolver.resolve(clsname, folder)
# 
# Path: lib/Tools/InstanceResolver.py
# class InstanceResolver:
#     def __init__(self, instantiate=True):
#         self.instantiate = instantiate
# 
#     def resolve(self, name, path='lib.Subcommands'):
#         class_name = Casify.to_pascal_case(name)
#         module_name = path + "." + class_name
#         try:
#             mod = importlib.import_module(module_name)
#             cls = getattr(mod, class_name)
#         except ImportError as e:
#             if e.name != module_name:
#                 raise
#             else:
#                 raise SubcommandNotFoundError(name) from e
#         if self.instantiate:
#             return cls()
#         else:
#             return cls
# 
# Path: lib/Wrappers/ArgumentParser.py
# class ArgumentParser:
#     DEFAULT_VERSION = 'last stable'
# 
#     def __init__(self, *args, argument_parser=None, version_provider=None, **kwargs):
#         self.parser = argument_parser or argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
#                                                                  *args,
#                                                                  **kwargs)
#         self._common_args()
# 
#     def add_argument(self, *args, **kwargs):
#         self.parser.add_argument(*args, **kwargs)
# 
#     def parse_args(self, args):
#         arguments = self.parser.parse_args(args)
#         if 'version' in arguments and arguments.version == self.DEFAULT_VERSION:
#             arguments.version = '1.0'
# 
#         return arguments
# 
#     def _common_args(self):
#         self.parser.add_argument('-S', '--settings', metavar='SETTINGS', type=str,
#                                  help='Path to the settings file.', default="settings.cfg")


from lib.Tools.Casify import to_dash_case
from lib.Tools.InstanceCollector import InstanceCollector
from lib.Tools.InstanceResolver import InstanceResolver
from lib.Wrappers.ArgumentParser import ArgumentParser


class InfracommandRouter:
    def __init__(self,
                 subcommands_path,
                 description,
                 arg_name,
                 arg_help,

# Path: lib/Tools/Casify.py
# def to_dash_case(name):
#     titles = _get_words(name)
#     return "-".join(titles)
# 
# Path: lib/Tools/InstanceCollector.py
# class InstanceCollector:
#     def __init__(self, instantiate=True, *, instance_resolver=None, glob=None):
#         self.instance_resolver = instance_resolver or InstanceResolver(instantiate)
#         self.glob = glob or global_glob
# 
#     # this returns an iterator!
#     def collect(self, path):
#         for filename in self.glob.iglob(os.path.join(path, '*.py')):
#             modparts = filename.replace('/', '.').split('.')[:-1]
#             clsname = modparts[-1]
#             folder = ".".join(modparts[:-1])
#             yield self.instance_resolver.resolve(clsname, folder)
# 
# Path: lib/Tools/InstanceResolver.py
# class InstanceResolver:
#     def __init__(self, instantiate=True):
#         self.instantiate = instantiate
# 
#     def resolve(self, name, path='lib.Subcommands'):
#         class_name = Casify.to_pascal_case(name)
#         module_name = path + "." + class_name
#         try:
#             mod = importlib.import_module(module_name)
#             cls = getattr(mod, class_name)
#         except ImportError as e:
#             if e.name != module_name:
#                 raise
#             else:
#                 raise SubcommandNotFoundError(name) from e
#         if self.instantiate:
#             return cls()
#         else:
#             return cls
# 
# Path: lib/Wrappers/ArgumentParser.py
# class ArgumentParser:
#     DEFAULT_VERSION = 'last stable'
# 
#     def __init__(self, *args, argument_parser=None, version_provider=None, **kwargs):
#         self.parser = argument_parser or argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
#                                                                  *args,
#                                                                  **kwargs)
#         self._common_args()
# 
#     def add_argument(self, *args, **kwargs):
#         self.parser.add_argument(*args, **kwargs)
# 
#     def parse_args(self, args):
#         arguments = self.parser.parse_args(args)
#         if 'version' in arguments and arguments.version == self.DEFAULT_VERSION:
#             arguments.version = '1.0'
# 
#         return arguments
# 
#     def _common_args(self):
#         self.parser.add_argument('-S', '--settings', metavar='SETTINGS', type=str,
#                                  help='Path to the settings file.', default="settings.cfg")


# Path: lib/Tools/InfracommandRouter.py
from lib.Tools.Casify import to_dash_case
from lib.Tools.InstanceCollector import InstanceCollector
from lib.Tools.InstanceResolver import InstanceResolver
from lib.Wrappers.ArgumentParser import ArgumentParser



class InfracommandRouter:
    def __init__(self,
                 subcommands_path,
                 description,
                 arg_name,
                 arg_help,

                 *,