Module: ThreeScaleToolbox::CLI
- Defined in:
- lib/3scale_toolbox/cli.rb,
lib/3scale_toolbox/cli/output_flag.rb,
lib/3scale_toolbox/cli/json_printer.rb,
lib/3scale_toolbox/cli/yaml_printer.rb,
lib/3scale_toolbox/cli/error_handler.rb,
lib/3scale_toolbox/cli/custom_table_printer.rb
Defined Under Namespace
Classes: CustomTablePrinter, ErrorHandler, JsonPrinter, PrinterTransformer, YamlPrinter
Class Method Summary
collapse
Class Method Details
.add_command(command) ⇒ Object
12
13
14
|
# File 'lib/3scale_toolbox/cli.rb', line 12
def self.add_command(command)
root_command.add_subcommand(command)
end
|
.install_signal_handlers ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/3scale_toolbox/cli.rb', line 20
def self.install_signal_handlers
available_signals = %w[INT TERM].select { |signal_name| Signal.list.key? signal_name }
available_signals.each do |signal|
Signal.trap(signal) do
puts
exit!(0)
end
end
if !defined?(RUBY_ENGINE) || RUBY_ENGINE != 'jruby'
if Signal.list.key? 'USR1'
Signal.trap('USR1') do
puts 'Caught USR1; dumping a stack trace'
puts caller.map { |i| " #{i}" }.join("\n")
end
end
end
end
|
.load_builtin_commands ⇒ Object
.output_flag(dsl) ⇒ Object
16
17
18
|
# File 'lib/3scale_toolbox/cli/output_flag.rb', line 16
def self.output_flag(dsl)
dsl.option :o, :output, 'Output format. One of: json|yaml', argument: :required, transform: PrinterTransformer.new
end
|