From 5e55ef672bc40ba43ecf2951a09a1128dfb1b337 Mon Sep 17 00:00:00 2001 From: Enrico Stahn Date: Fri, 27 Mar 2015 13:43:50 +1100 Subject: [PATCH] Migrate all options to thor --- lib/github_changelog_generator/cli.rb | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/cli.rb b/lib/github_changelog_generator/cli.rb index 3119cc6..3e45564 100644 --- a/lib/github_changelog_generator/cli.rb +++ b/lib/github_changelog_generator/cli.rb @@ -26,10 +26,37 @@ module GitHubChangelogGenerator option :user, aliases: '-u', type: :string, desc: 'Username of the owner of target GitHub repo' option :project, aliases: '-p', type: :string, desc: 'Username of the owner of target GitHub repo' option :token, aliases: '-t', type: :string, desc: 'To make more than 50 requests per hour your GitHub token required. You can generate it here: https://github.com/settings/tokens/new' + option :date_format, aliases: '-f', type: :string, default: '%d/%m/%y', desc: 'Date format.' + option :output, aliases: '-o', type: :string, default: 'CHANGELOG.md', desc: 'Output file.' + # TODO: Should be "closed_issues" + option :issues, type: :boolean, default: true, desc: 'Include closed issues to changelog.' option :issues_wo_labels, type: :boolean, default: true, desc: 'Include closed issues without labels to changelog.' + option :pr_wo_labels, type: :boolean, default: true, desc: 'Include pull requests without labels to changelog.' + option :pull_requests, type: :boolean, default: true, desc: 'Include pull-requests to changelog.' + option :filter_by_milestone, type: :boolean, default: true, desc: 'Use milestone to detect when issue was resolved.' + option :author, type: :boolean, default: true, desc: 'Add author of pull-request in the end.' + option :unreleased_only, type: :boolean, default: true, desc: 'Generate log from unreleased closed issues only.' + option :unreleased, type: :boolean, default: true, desc: 'Add to log unreleased closed issues.' + option :unreleased_label, type: :boolean, default: true, desc: 'Add to log unreleased closed issues.' + option :compare_link, type: :boolean, default: true, desc: 'Include compare link (Full Changelog) between older version and newer version.' + option :include_labels, type: :array, default: %w(bug enhancement), desc: 'Issues only with that labels will be included to changelog.' + option :exclude_labels, type: :array, default: %w(duplicate question invalid wontfix), desc: 'Issues with that labels will be always excluded from changelog.' + option :max_issues, type: :numeric, desc: 'Max number of issues to fetch from GitHub. Default is unlimited' + option :github_site, :banner => 'URL', type: :string, desc: 'The Enterprise Github site on which your project is hosted.' + option :github_api, :banner => 'URL', type: :string, desc: 'The enterprise endpoint to use for your Github API.' + option :simple_list, type: :boolean, default: false, desc: 'Create simple list from issues and pull requests.' + option :verbose, type: :boolean, default: true, desc: 'Run verbosely.' + long_desc <<-LONGDESC +Automatically generate change log from your tags, issues, labels and pull requests on GitHub. + LONGDESC def generate - print_table([['Project:', 'zanui/chef-thumbor'], ['Username:', 'estahn']]) + end + + map %w[--version -v] => :__print_version + desc '--version, -v', 'print the version' + def __print_version + puts "Version: #{GitHubChangelogGenerator::VERSION}" end end end