-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from chelnak/show_command
Add show command
- Loading branch information
Showing
8 changed files
with
296 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
# Make your changelogs ✨ | ||
|
||
[![ci](https://github.com/chelnak/gh-changelog/actions/workflows/ci.yml/badge.svg)](https://github.com/chelnak/gh-changelog/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/release/chelnak/gh-changelog.svg)](https://github.com/chelnak/gh-changelog/releases/latest) | ||
[![ci](https://github.com/chelnak/gh-changelog/actions/workflows/ci.yml/badge.svg)](https://github.com/chelnak/gh-changelog/actions/workflows/ci.yml) | ||
[![Release](https://img.shields.io/github/release/chelnak/gh-changelog.svg)](https://github.com/chelnak/gh-changelog/releases/latest) | ||
|
||
An opinionated [GitHub Cli](https://github.com/cli/cli) extension for creating changelogs that adhere to the [keep a changelog](https://keepachangelog.com/en/1.0.0/) specification. | ||
|
||
## Installation and Usage | ||
|
||
Before you start make sure that: | ||
|
||
- GitHub Cli is [installed](https://cli.github.com/manual/installation) and [authenticated](https://cli.github.com/manual/gh_auth_login) | ||
- You are inside a git repository | ||
- The repository contains commits and has been pushed to GitHub | ||
|
||
### Install | ||
|
||
```bash | ||
# Install | ||
gh extension install chelnak/gh-changelog | ||
``` | ||
|
||
### Upgrade | ||
|
||
```bash | ||
# Upgrade | ||
gh extension upgrade chelnak/gh-changelog | ||
``` | ||
|
||
Before you start make sure that: | ||
### Create a new changelog | ||
|
||
- GitHub Cli is [installed](https://cli.github.com/manual/installation) and [authenticated](https://cli.github.com/manual/gh_auth_login) | ||
- You are inside a git repository | ||
- The repository contains commits and has been pushed to GitHub | ||
```bash | ||
gh changelog new | ||
``` | ||
|
||
Basic usage is simple. Just run the following command: | ||
### View your changelog in the terminal | ||
|
||
```bash | ||
gh changelog | ||
gh changelog show | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/briandowns/spinner" | ||
"github.com/chelnak/gh-changelog/internal/pkg/changelog" | ||
"github.com/chelnak/gh-changelog/internal/pkg/writer" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
var newCmd = &cobra.Command{ | ||
Use: "new", | ||
Short: "Creates a new changelog from activity in the current repository", | ||
Long: "Creates a new changelog from activity the current repository.", | ||
RunE: func(command *cobra.Command, args []string) error { | ||
s := spinner.New(spinner.CharSets[11], 100*time.Millisecond) | ||
_ = s.Color("green") | ||
s.FinalMSG = fmt.Sprintf("✅ Open %s or run 'gh changelog show' to view your changelog.\n", viper.GetString("fileName")) | ||
|
||
changeLog, err := changelog.MakeFullChangelog(s) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
s.Stop() | ||
return writer.Write(changeLog) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/chelnak/gh-changelog/internal/pkg/markdown" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
var showCmd = &cobra.Command{ | ||
Use: "show", | ||
Short: "Renders a changelog in the terminal", | ||
Long: "Renders the changelog in the terminal", | ||
RunE: func(command *cobra.Command, args []string) error { | ||
|
||
changelog := viper.GetString("fileName") | ||
return markdown.Render(changelog) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.