def run(opts): bindings = { 'target': opts.get('<target>'), 'from': convert_path(opts.get('<from>')), 'checkout': opts.get('<checkout>'), 'app': 'app', 'proj': inflection.camelize(opts.get('<target>').split('/')[-1]), 'file': opts.get('--file') } if bindings.get('file'): with open(bindings.get('file')) as f: conf = json.load(f) check_conflict(conf) bindings.update(conf) opt_json = json.loads(opts.get('--json')) check_conflict(opt_json) bindings.update(opt_json) location = get_location(bindings) try: copy(f'{location}/new', bindings.get('target'), data=bindings, exclude=['*/__pycache__/*']) except ValueError as err: print(f'Error: {err}')
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/*'])
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/*'])
def run(opts): model.run(opts) sch_opts = opt_pipe(opts) schema.run(sch_opts) bindings = { 'module': opts.get('<module>'), 'singular': inflection.underscore(opts.get('<module>')), 'plural': opts.get('<table>'), 'table': opts.get('<table>'), 'fields': opts.get('<fields>') } bindings.update(get_proj_info()) location = get_location(bindings) or TPL_PATH copy(f'{location}/gen', '.', data=bindings, exclude=['*/models/*', '*/schemas/*', 'test/*'])