コード例 #1
0
def run(opts):
    validate_opts(opts)

    bindings = {
        'module': opts.get('<module>'),
        'singular': inflection.underscore(opts.get('<module>')),
        'model': inflection.camelize(opts.get('--model')) if opts.get('--model') else '',
        'fields': parse_fields(opts.get('<fields>')),
    }
    bindings.update(get_proj_info())
    bindings.update(collect_meta(bindings.get('fields')))

    location = get_location(bindings) or TPL_PATH
    copy(f'{location}/gen', '.', data=bindings, exclude=['*/models/*', '*/views/*', 'tests/*'])
コード例 #2
0
def run(opts):
    validate_opts(opts)

    bindings = {
        'module': opts.get('<module>'),
        'singular': inflection.underscore(opts.get('<module>')),
        'table': opts.get('<table>'),
        'fields': parse_fields(opts.get('<fields>'))
    }
    bindings.update(get_proj_info())

    location = get_location(bindings) or TPL_PATH
    copy(f'{location}/gen',
         '.',
         data=bindings,
         exclude=['*/schemas/*', '*/views/*', 'test/*'])