Exemplo n.º 1
0
 def get_handler_cname(self):
     if self.type not in [
         CD_TYPE_OLDINPUT,
         CD_TYPE_ARGV,
         CD_TYPE_ARGV_MODES,
         CD_TYPE_ARGV_STATE,
     ]:
         return None
     return get_handler_cname(self.type, self.handler, self.cname)
Exemplo n.º 2
0
def find_c_name_handler(basedir, rzcommand):
    for f in get_yaml_files(basedir):
        with open(f, "r", encoding="utf8") as of:
            y = yaml.safe_load(of)
            e = find_entry(y["commands"], rzcommand)
            if e is not None:
                cname = e.get("cname", compute_cname(e["name"]))
                return get_handler_cname(
                    e.get("type", None), e.get("handler", None), cname
                )

    return None