Module: Lydown::CLI
- Defined in:
- lib/lydown/cli.rb,
lib/lydown/cli/output.rb,
lib/lydown/cli/signals.rb,
lib/lydown/cli/commands.rb
Defined Under Namespace
Modules: Compiler, Diff, Proofing, REPL, Support, Translation
Classes: Commands
Constant Summary
collapse
- PROGRESS_FORMAT =
'%t:%B:%p%%'
- @@abortable_child_processes =
[]
Class Method Summary
collapse
Class Method Details
.abort ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/lydown/cli/signals.rb', line 4
def self.abort
$stderr.puts
if pid = @@abortable_child_processes.last
Process.kill("INT", pid)
else
exit
end
end
|
.register_abortable_process(pid) ⇒ Object
13
14
15
|
# File 'lib/lydown/cli/signals.rb', line 13
def self.register_abortable_process(pid)
@@abortable_child_processes << pid
end
|
.show_progress(title, total) ⇒ Object
Simple wrapper around ProgressBar
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/lydown/cli/output.rb', line 7
def self.show_progress(title, total)
$progress_bar = ProgressBar.create(
title: title,
total: total,
format: PROGRESS_FORMAT,
)
yield $progress_bar
ensure
$progress_bar.stop
$progress_bar = nil
end
|
.unregister_abortable_process(pid) ⇒ Object
17
18
19
|
# File 'lib/lydown/cli/signals.rb', line 17
def self.unregister_abortable_process(pid)
@@abortable_child_processes.delete pid
end
|