Translate option names

This commit is contained in:
Olle Jonsson 2016-03-17 21:08:17 +01:00
parent 44bbd9ca01
commit d0bd44e0c8

View File

@ -23,7 +23,7 @@ module GitHubChangelogGenerator
def parse_line!(line)
key_sym, value = extract_pair(line)
@options[key_sym] = convert_value(value, key_sym)
@options[translate_option_name(key_sym)] = convert_value(value, key_sym)
rescue
raise ParserError, "Config file #{file} is incorrect in line \"#{line.gsub(/[\n\r]+/, '')}\""
end
@ -54,5 +54,21 @@ module GitHubChangelogGenerator
value
end
end
def translate_option_name(key_sym)
{
bugs_label: :bug_prefix,
enhancement_label: :enhancement_prefix,
issues_label: :issue_prefix,
header_label: :header,
front_matter: :frontmatter,
pr_label: :merge_prefix,
issues_wo_labels: :add_issues_wo_labels,
pr_wo_labels: :add_pr_wo_labels,
pull_requests: :pulls,
filter_by_milestone: :filter_issues_by_milestone,
github_api: :github_endpoint
}.fetch(key_sym) { key_sym }
end
end
end