17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/crudboy/cli.rb', line 17
def parse_options!
@options = OpenStruct.new(config_file: default_config_file,
initializer: default_initializer,
destination: Dir.pwd,
ssh: {})
OptionParser.new do |opts|
opts.banner = " Usage: crudboy [options] [ruby file]\n\n If neither [ruby file] nor -e option specified, and STDIN is not a tty, a Pry REPL will be launched,\n otherwise the specified ruby file or -e option value or ruby code read from STDIN will be run, and no REPL launched\n\n EOF\n\n opts.on('-cCONFIG_FILE', '--conf=CONFIG_FILE', 'Specify config file, default is $HOME/.crudboy.yml, or $HOME/.crudboy.d/init.yml.') do |config_file|\n @options.config_file = config_file\n end\n\n opts.on('-iINITIALIZER', '--initializer=INITIALIZER', 'Specify initializer ruby file, default is $HOME/.crudboy.rb, or $HOME/.crudboy.d/init.rb.') do |initializer|\n @options.initializer = initializer\n end\n\n opts.on('-eENVIRON', '--env=ENVIRON', 'Specify config environment.') do |env|\n @options.env = env\n end\n\n opts.on('-tTABLE_NAME', '--table=TABLE_NAME', 'Specify table name') do |table_name|\n @options.table_name = table_name\n end\n\n opts.on('-mMODEL_NAME', '--model=MODEL_NAME', 'Specify model name') do |model_name|\n @options.model_name = model_name\n end\n\n opts.on('-oOUTPUT', '--output=OUTPUT', 'Specify output path, default: $PWD') do |destination|\n @options.destination = destination\n end\n\n opts.on('-bTEMPLATE_BUNDLE', '--bundle=TEMPLATE_BUNDLE', 'Specify template bundle, may be a path point to a .crudboy file or a directory') do |template_bundle|\n @options.template_bundle = config_template_bundle(template_bundle)\n end\n\n opts.on('', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n end.parse!\n\n @options.template_args = ARGV\nend\n"
|