示例#1
0
def do_validate_opts(env, opts):
    """validate all options and fill them, if needed"""

    if opts.has_key('debug') and opts['debug'] is not None:
        opts['theme'] = 'default'
        opts['project'] = 'debug'
        opts['accept_all'] = True
    else:
        if not opts['builder'] in env.builder_dct:
            print colors.red(
                _("The builder %r is not defined") % opts['builder'])
            env.exit_globby()
        if opts['project'] is None:
            projects = env.project.all_projects
            ask_user(env, 'project', opts, projects, N_('projects'))

        if opts['theme'] is None or opts['theme'] == 'default':
            if opts['theme'] == 'default' and not opts['accept_all']:
                print _(
                    "\nYou've choosen the default theme.\n"
                    "If this is your choice accept with 'y' otherwise apply a 'n'."
                )
                if not raw_input(_("your Choice (y/n): ")) in ['j', 'y']:
                    themes = env.theme.all_themes
                    ask_user(env, 'theme', opts, themes, N_('themes'))
        print '\n'
    return opts
示例#2
0
def do_validate_opts(env, opts):
    """validate all options and fill them, if needed"""

    if opts.has_key('debug') and opts['debug'] is not None:
        opts['theme'] = 'default'
        opts['project'] = 'debug'
        opts['accept_all'] = True
    else:
        if not opts['builder'] in env.builder_dct:
            print colors.red(_("The builder %r is not defined") % opts['builder'])
            env.exit_globby()
        if opts['project'] is None:
            projects = env.project.all_projects
            ask_user(env, 'project', opts, projects, N_('projects'))

        if opts['theme'] is None or opts['theme'] == 'default':
            if opts['theme'] == 'default' and not opts['accept_all']:
                print _("\nYou've choosen the default theme.\n"
                       "If this is your choice accept with 'y' otherwise apply a 'n'.")
                if not raw_input(_("your Choice (y/n): ")) in ['j', 'y']:
                    themes = env.theme.all_themes
                    ask_user(env, 'theme', opts, themes, N_('themes'))
        print '\n'
    return opts
示例#3
0
 def format_usage(self, usage):
     return colors.red(_('\nusage: %s\n') % usage)
示例#4
0
 def format_usage(self, usage):
     return colors.red(_('\nusage: %s\n') % usage)