diff --git a/CHANGELOG.md b/CHANGELOG.md index bc268fa..56beb09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [[1.2.0]] - 2020.01.06 + +### Added + +- Add a flag allowing the user to specify the Changelog file to read from. + ## [[1.1.2]] - 2019.12.30 ### Fixed diff --git a/cmd/root.go b/cmd/root.go index 5889a69..6f700e0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -24,9 +24,11 @@ var rootCmd = &cobra.Command{ // Get the flags. extract, err := cmd.Flags().GetBool("extract") utils.Check(err) + file, err := cmd.Flags().GetString("file") + utils.Check(err) // Read the last release information from the Changelog. - title, content, err := keeparelease.ReadChangelog("") + title, content, err := keeparelease.ReadChangelog(file) utils.Check(err) // If extract only, simply display the content of the last release. @@ -81,6 +83,7 @@ func init() { rootCmd.Flags().BoolP("extract", "x", false, "Only extract the last release information") rootCmd.Flags().StringP("tag", "t", "", "Use a specific tag") rootCmd.Flags().StringArrayP("attach", "a", []string{}, "Specify the assets to include into the release") + rootCmd.Flags().StringP("file", "f", "CHANGELOG.md", "Specify a changelog file") } func uploadAssets(gh *github.Client, release *github.Release, assets []string) { diff --git a/keeparelease/keeparelease.go b/keeparelease/keeparelease.go index 060cb8a..25fd4e4 100644 --- a/keeparelease/keeparelease.go +++ b/keeparelease/keeparelease.go @@ -64,9 +64,6 @@ func ParseChangelog(changelog string) (title, content string, err error) { // ReadChangelog reads the changelog file. // Returns the title of the last release as well as its content. func ReadChangelog(file string) (title, content string, err error) { - if file == "" { - file = "CHANGELOG.md" - } dat, err := ioutil.ReadFile(file) if err != nil { return "", "", err