require "thor"
module GitReleaseNotes
  class CLI < Thor
    include Thor::Actions

    desc "html", "Generates a HTML release notes document"
    method_option :from, type: :string, required: true, aliases: "-f"
    method_option :to, type: :string, required: true, aliases: "-t"
    method_option :git_web_url, type: :string, required: true, aliases: "-u"
    method_option :exclude_submodules_without_changes, type: :boolean, aliases: "-e"

    def html
      whats_in_the_deploy = GitParentRange.new(options[:from],
                                               options[:to],
                                               options[:git_web_url],
                                               !options[:exclude_submodules_without_changes])
      puts whats_in_the_deploy.generate_html
    end
  end
end


require "thor"
module GitReleaseNotes
  class CLI < Thor
    include Thor::Actions

    desc "html", "Generates an HTML release notes document showing all commits between two refs\n" +
		 "including commits within submodules"
    method_option :from,
		   desc: "SHA, tag, or other tree-ish reference for the start of the range",
		   banner: "SHA, tag, or other tree-ish reference for the start of the range",
		   type: :string,
		   required: true,
		   aliases: "-f"
    method_option :to,
		   desc: "SHA, tag, or other tree-ish reference for the end of the range",
		   banner: "SHA, tag, or other tree-ish reference for the end of the range",
		   type: :string,
		   required: true,
		   aliases: "-t"
    method_option :git_web_url,
		   desc: "URL of the root repository, used to create links in the generated HTML doc",
		   banner: "URL of the root repository, used to create links in the generated HTML doc",
		   type: :string,
		   default: "https://github.com/cloudfoundry/cf-release",
		   aliases: "-u"
    method_option :exclude_submodules_without_changes,
		   desc: "Exclude showing submodules in HTML doc if there are 0 commits to it in the given range",
		   banner: "Exclude showing submodules in HTML doc if there are 0 commits to it in the given range",
		   type: :boolean,
		   default: false,
		   aliases: "-e"

    def html
      puts GitParentRange.new(
	options[:from],
        options[:to],
        options[:git_web_url],
        options[:exclude_submodules_without_changes],
      ).generate_html
    end
  end
end


Improve usage, and make github.com/cloudfoundry/cf-release default web URL
Improve usage, and make github.com/cloudfoundry/cf-release default web URL
