

def write(self, genSubs=True):
    '\n        Generate the completion function and write it to the output file\n        @return: C{None}\n\n        @type genSubs: C{bool}\n        @param genSubs: Flag indicating whether or not completions for the list\n            of subcommand should be generated. Only has an effect\n            if the C{subCommands} attribute has been defined on the\n            L{twisted.python.usage.Options} instance.\n        '
    if (genSubs and (getattr(self.options, 'subCommands', None) is not None)):
        gen = ZshArgumentsGenerator(self.options, self.cmdName, self.file)
        gen.extraActions.insert(0, SubcommandAction())
        gen.write()
        self.file.write('local _zsh_subcmds_array\n_zsh_subcmds_array=(\n')
        for (cmd, short, parser, desc) in self.options.subCommands:
            self.file.write(('"%s:%s"\n' % (cmd, desc)))
        self.file.write(')\n\n')
        self.file.write('_describe "sub-command" _zsh_subcmds_array\n')
    else:
        gen = ZshArgumentsGenerator(self.options, self.cmdName, self.file)
        gen.write()

dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/_shellcomp.py ZshBuilder.write/original