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
|
# File 'lib/transducer/cli.rb', line 16
def generate(input_file)
unless File.exist?(input_file)
error "Input file not found: #{input_file}"
exit 1
end
output_file = options[:output]
template_path = options[:template]
parser = Parser.new(input_file)
data = parser.parse
generator = Generator.new(data, template_path: template_path)
generator.to_file(output_file)
success "Documentation generated successfully: #{output_file}"
rescue FileError => e
error "File error: #{e.message}"
exit 1
rescue ParseError => e
error "Parse error: #{e.message}"
exit 2
rescue ValidationError => e
error "Validation error: #{e.message}"
exit 3
rescue StandardError => e
error "Unexpected error: #{e.message}"
exit 4
end
|