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
|
# File 'lib/gitlab/shell.rb', line 16
def start
trap('INT') { quit_shell } setup
while (buffer = Readline.readline('gitlab> '))
begin
parse_input buffer
@arguments.map! { |arg| symbolize_keys(yaml_load(arg)) }
case buffer
when nil, ''
next
when 'exit'
quit_shell
when /^\bhelp\b+/
puts help(arguments[0]) { |out| out.gsub!(/Gitlab\./, 'gitlab> ') }
else
history << buffer
data = execute command, arguments
output_table command, arguments, data
end
rescue StandardError => e
puts e.message
end
end
quit_shell end
|