Skip to content

Commit

Permalink
feat: changelog initialisation defaults file path to repo root.
Browse files Browse the repository at this point in the history
  • Loading branch information
outofcoffee committed Dec 21, 2023
1 parent 27650b5 commit c8eccb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ Global Flags:

---

### `changelog init`

Initialises a new changelog file based on the specified git repository.

```bash
Usage:
since changelog init [flags]

Flags:
-g, --git-repo string Path to git repository (default ".")
-h, --help help for init
-o, --order-by string How to determine the latest tag (alphabetical|commit-date|semver)) (default "semver")
--unique De-duplicate commit messages (default true)
```

---

### `project changes`

Reads the commit history for the current git repository, starting
Expand Down
7 changes: 4 additions & 3 deletions cmd/changelog_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/release-tools/since/cfg"
"github.com/release-tools/since/changelog"
"github.com/release-tools/since/vcs"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand All @@ -34,12 +35,11 @@ var initArgs struct {
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialise a new changelog file",
Long: `Initialises a new changelog file with a placeholder entry.`,
Long: `Initialises a new changelog file based on the specified git repository.`,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
workingDir := getWorkingDir()
changelogFile := changelog.ResolveChangelogFile(
workingDir,
initArgs.repoPath,
changelogArgs.changelogFile,
)
initChangelog(
Expand Down Expand Up @@ -74,4 +74,5 @@ func initChangelog(
panic(err)
}
fmt.Println(newChangelog)
logrus.Infof("initialised changelog file '%s'", changelogFile)
}

0 comments on commit c8eccb0

Please sign in to comment.