Skip to content

Commit

Permalink
説明の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
harakeishi committed Feb 26, 2022
1 parent 89115bf commit ea791cf
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions README.md
@@ -1,5 +1,5 @@
![logo](logo.png)
[![GitHub release](https://img.shields.io/github/release/harakeishi/curver.svg)](https://github.com/harakeishi/curver/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/harakeishi/curver)](https://goreportcard.com/report/github.com/harakeishi/curver) [![Test](https://github.com/harakeishi/curver/actions/workflows/test.yml/badge.svg)](https://github.com/harakeishi/curver/actions/workflows/test.yml)
[![GitHub release](https://img.shields.io/github/release/harakeishi/curver.svg)](https://github.com/harakeishi/curver/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/harakeishi/curver)](https://goreportcard.com/report/github.com/harakeishi/curver)

`curver` is a simple way to display the version of a CUI tool made with go.
`curver` was named as an abbreviation for `current version`.
Expand All @@ -9,8 +9,9 @@
- [Importing](#importing)
- [Documentation](#documentation)
- [usage](#usage)
- [normal](#normal)
- [use go build](#use-go-build)
- [use goreleaser](#use-goreleaser)
- [If you only want the version](#if-you-only-want-the-version)
- [License](#license)

# Installation
Expand All @@ -32,7 +33,7 @@ Visit the docs on [GoDoc](https://pkg.go.dev/github.com/harakeishi/curver)
If the value using ldflag is stored in the variable Version, that value will be displayed.
Otherwise, it will display the build information embedded in the running binary.

## normal
## use go build
```go
// main.go
package main
Expand Down Expand Up @@ -60,7 +61,7 @@ version: v0.1.0
If you want to embed the result of 'git tag', you can do the following

```
$ go build -ldflags "-X github.com/harakeishi/curver.Version=$(git describe --tags)" -o ./cmds
$ go build -ldflags "-X github.com/harakeishi/curver.Version=$(git describe --tags)" -o ./main
```
## use goreleaser
If you are using [goreleaser](https://goreleaser.com/) to do the release, do the following
Expand All @@ -72,6 +73,22 @@ builds:

```

## If you only want the version
The following will return the version as a string.

```go
// main.go
package main

import (
"github.com/harakeishi/curver"
)

func main () {
version := curver.GetVersion()
}
```

# License
Copyright (c) 2022 harakeishi
Licensed under [MIT](LICENSE)

0 comments on commit ea791cf

Please sign in to comment.