def addDashboardOptions(parser, with_submit=True):
    """
    Add dashboard-related options to the option parser (optparse.OptionParser
    instance).
    """
    from optparse import OptionGroup
    group = OptionGroup(parser, 'Dashboard Options')
    if with_submit:
        group.add_option('--submit', action='store_true', default=False,
            help='submit the results to Dashboard server')
        group.add_option('--no-submit', action='store_false', dest='submit',
            help='do not submit the results to Dashboard server (default)')
    group.add_option('--flavour', default='nightly', help=
        'which build server to use (build flavour)')
    group.add_option('--db-url', help=
        'database server to use instead of the default one')
    group.add_option('--db-name', help=
        'override database name [default: nightlies-{flavour}]')
    parser.add_option_group(group)
    return parser
