5
6
7
8
9
10
11
12
13
14
15
16
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
|
# File 'lib/td/command/options.rb', line 5
def job_show_options(op)
opts = {}
opts[:verbose] = nil
opts[:wait] = false
opts[:output] = nil
opts[:format] = nil
opts[:render_opts] = {:header => false}
opts[:limit] = nil
opts[:exclude] = false
op.on('-v', '--verbose', 'show logs', TrueClass) {|b|
opts[:verbose] = b
}
op.on('-w', '--wait', 'wait for finishing the job', TrueClass) {|b|
opts[:wait] = b
}
op.on('-G', '--vertical', 'use vertical table to show results', TrueClass) {|b|
opts[:render_opts][:vertical] = b
}
op.on('-o', '--output PATH', 'write result to the file') {|s|
unless Dir.exist?(File.dirname(s))
s = File.expand_path(s)
end
opts[:output] = s
opts[:format] ||= 'tsv'
}
op.on('-l', '--limit ROWS', 'limit the number of result rows shown when not outputting to file') {|s|
unless s.to_i > 0
raise "Invalid limit number. Must be a positive integer"
end
opts[:limit] = s.to_i
}
op.on('-c', '--column-header', 'output of the columns\' header when the schema is available',
' for the table (only applies to tsv and csv formats)', TrueClass) {|b|
opts[:render_opts][:header] = b;
}
op.on('-x', '--exclude', 'do not automatically retrieve the job result', TrueClass) {|b|
opts[:exclude] = b
}
op.on('--null STRING', "null expression in csv or tsv") {|s|
opts[:render_opts][:null_expr] = s.to_s
}
write_format_option(op) {|s| opts[:format] = s }
opts
end
|