# Path: sibyl/config.py
# class Config(object):
#     def __init__(self, default_config, files):
#     def expandpath(path):
#     def parse_files(self, files):
#     def dump(self):
#     def jit_engine(self):
#     def available_tests(self):
#     def miasm_engine(self):
#     def pin_root(self):
#     def pin_tracer(self):
#     def prune_strategy(self):
#     def prune_keep(self):
#     def prune_keep_max(self):
#     def stubs(self):
#     def idaq64_path(self):
#     def ghidra_headless_path(self):
#     def ghidra_export_function(self):
# 
# Path: sibyl/actions/action.py
# class Action(object):
# 
#     "Parent class for actions"
# 
#     _name_ = ""
#     _desc_ = ""
#     _args_ = []  # List of (*args, **kwargs)
# 
#     def __init__(self, command_line):
#         # Parse command line
#         parser = argparse.ArgumentParser(
#             prog="%s %s" % (sys.argv[0], self._name_))
#         for args, kwargs in self._args_:
#             parser.add_argument(*args, **kwargs)
#         self.args = parser.parse_args(command_line)
# 
#         # Run action
#         self.run()
# 
#     def run(self):
#         raise NotImplementedError("Abstract method")
# 
#     @property
#     def name(self):
#         """Action name"""
#         return self._name_
# 
#     @property
#     def description(self):
#         """Action description"""
#         return self._desc_


import os
from sibyl.config import config, config_paths
from sibyl.actions.action import Action
    """Configuration management"""

    _name_ = "config"
    _desc_ = "Configuration management"
    _args_ = [
        (("-V", "--value"), {"help": "Return the value of a specific option"}),
        (("-d", "--dump"), {"help": "Dump the current configuration",
                            "action": "store_true"}),
    ]

    def run(self):
        if self.args.dump:
            print "\n".join(config.dump())
        elif self.args.value:
            if self.args.value.endswith("_keys") and hasattr(config,
                                                             self.args.value[:-5]):
                val = getattr(config, self.args.value[:-5]).keys()
            elif hasattr(config, self.args.value):
                val = getattr(config, self.args.value)
            else:
                val = "ERROR"
            print val
        else:
            self.show()

    def show(self):
        # Configuration files
        files = [fpath for fpath in config_paths if os.path.isfile(fpath)]
        if not files:
            print "No configuration file found. Supported paths:"

# Path: sibyl/config.py
# class Config(object):
#     def __init__(self, default_config, files):
#     def expandpath(path):
#     def parse_files(self, files):
#     def dump(self):
#     def jit_engine(self):
#     def available_tests(self):
#     def miasm_engine(self):
#     def pin_root(self):
#     def pin_tracer(self):
#     def prune_strategy(self):
#     def prune_keep(self):
#     def prune_keep_max(self):
#     def stubs(self):
#     def idaq64_path(self):
#     def ghidra_headless_path(self):
#     def ghidra_export_function(self):
# 
# Path: sibyl/actions/action.py
# class Action(object):
# 
#     "Parent class for actions"
# 
#     _name_ = ""
#     _desc_ = ""
#     _args_ = []  # List of (*args, **kwargs)
# 
#     def __init__(self, command_line):
#         # Parse command line
#         parser = argparse.ArgumentParser(
#             prog="%s %s" % (sys.argv[0], self._name_))
#         for args, kwargs in self._args_:
#             parser.add_argument(*args, **kwargs)
#         self.args = parser.parse_args(command_line)
# 
#         # Run action
#         self.run()
# 
#     def run(self):
#         raise NotImplementedError("Abstract method")
# 
#     @property
#     def name(self):
#         """Action name"""
#         return self._name_
# 
#     @property
#     def description(self):
#         """Action description"""
#         return self._desc_


# Path: sibyl/actions/config.py
import os
from sibyl.config import config, config_paths
from sibyl.actions.action import Action

    """Configuration management"""

    _name_ = "config"
    _desc_ = "Configuration management"
    _args_ = [
        (("-V", "--value"), {"help": "Return the value of a specific option"}),
        (("-d", "--dump"), {"help": "Dump the current configuration",
                            "action": "store_true"}),
    ]

    def run(self):
        if self.args.dump:
            print "\n".join(config.dump())
        elif self.args.value:
            if self.args.value.endswith("_keys") and hasattr(config,
                                                             self.args.value[:-5]):
                val = getattr(config, self.args.value[:-5]).keys()
            elif hasattr(config, self.args.value):
                val = getattr(config, self.args.value)
            else:
                val = "ERROR"
            print val
        else:
            self.show()

    def show(self):
        # Configuration files
        files = [fpath for fpath in config_paths if os.path.isfile(fpath)]
        if not files:
            print "No configuration file found. Supported paths:"

            print "\t" + "\n\t".join(config_paths)