11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/genericode/cli/code_lister.rb', line 11
def list_codes(file_path, format: :tsv)
code_list = CodeList.from_file(file_path)
code_list.validate_verbose.each do |error|
raise Error, "#{error[:code]}: #{error[:message]}" if error[:code] == "INVALID_DATA_TYPE"
raise Error, "#{error[:code]}: #{error[:message]}" if error[:code] == "INVALID_COLUMN_REF"
end
case format
when :tsv
list_tsv(code_list)
when :table
list_table(code_list)
else
raise Error, "Unknown format: #{format}"
end
end
|