def gen_cls_doc(cls):
    print ".. _topology_%s:" %  cls.__name__
    print
    print_section("``%s`` Object" % cls.__name__, "=")
    print
    doc = cls.__doc__
    if doc != None:
        doc = textwrap.dedent(doc).strip()
    else:
        doc = ""    
    
    p_names = cls.properties.keys()
    p_names.sort()
    
    col_names = ["Property Name", "Type", "Required", "Editable"]
    rows = []
    for p_name in p_names:
        p = cls.properties[p_name]
        p_type = get_ptype(p)
            
        row = []
        
        row = [":ref:`%s <topology_%s_%s>`" % (p_name, cls.__name__, p_name), p_type]
        if p.required:
            row.append("**Yes**")
        else:
            row.append("No")

        if p.editable:
            row.append("Yes")
        else:
            row.append("No")

        rows.append(row)
        
    print ".. centered:: Summary of ``%s``'s Properties" % cls.__name__
    print
    print rest_table(col_names, rows)
    
    for p_name in p_names:
        p = cls.properties[p_name]
        description = textwrap.dedent(p.description).strip()

        p_type = get_ptype(p)

        print ".. _topology_%s_%s:" %  (cls.__name__, p_name)
        print     
        print_section(p_name,"-")
        print
        print "*Type*: %s" % p_type
        print
        print "*Required*:",
        if p.required:
            print "**Yes**"
        else:
            print "No"
        print
        print "*Editable*:",
        if p.editable:
            print "Yes"
        else:
            print "No"
        print 
        print description
        print
Beispiel #2
0
            doc = textwrap.dedent(doc).strip()
        else:
            doc = "TODO"
        print doc
        print

    opts = c.optparser.option_list
    if command != Command:
        opts = [opt for opt in opts if str(opt) not in common_options]
    c.optparser.formatter.store_option_strings(c.optparser)
    
    if len(opts) > 0:
        col_names = ["Option", "Description"]
        rows = []
        
        for opt in opts:
            if opt.action != "help":
                opt_string = "``%s``" % c.optparser.formatter.option_strings[opt]            
                opt_help = textwrap.dedent(opt.help).strip()                
                
                rows.append([opt_string, opt_help])
                
        print rest_table(col_names, rows)
    
    else:
        print "This command has no options (besides the :ref:`common options <cli_common>`)"    



    print