Skip to content

Commit d32f494

Browse files
committed
docs: extend usage examples
1 parent c612365 commit d32f494

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

packages/bin/README.md

+42-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
# @qiwi/buildstamp-cli
22
> golang ported Buildstamp CLI
33
4-
## Usage
4+
## Install
5+
**Precompiled**
56
```shell
7+
# fill the required tag and platform
8+
# like 2023.6.27-qiwi.buildstamp-bin.1.0.2-f0 and darwin-amd64
69
curl 'https://github.com/qiwi/buildstamp/releases/download/2023.6.27-qiwi.buildstamp-bin.1.0.2-f0/buildstamp-darwin-amd64.tar.gz' | tar -xvz --strip-components=1 -С . && ./buildstamp && rm ./buildstamp
710
```
8-
Output:
11+
12+
**Build locally**
13+
14+
```shell
15+
GOBIN=$(pwd) go install github.com/qiwi/buildstamp/packages/bin/src/main/go@$(curl 'https://api.github.com/repos/qiwi/buildstamp/commits/2023.7.2-qiwi.buildstamp-bin.1.6.0-f0' | jq -r '.sha')
16+
```
17+
18+
**As a module**
19+
```shell
20+
go get github.com/qiwi/buildstamp/packages/bin@$(curl 'https://api.github.com/repos/qiwi/buildstamp/commits/2023.7.2-qiwi.buildstamp-bin.1.6.0-f0' | jq -r '.sha')
21+
```
22+
23+
## Usage
24+
### CLI
25+
```shell
26+
buildstamp [opts]
27+
```
928
```json
1029
{
1130
"date": "2023-06-30T18:09:59+0300",
@@ -15,10 +34,6 @@ Output:
1534
}
1635
```
1736

18-
### CLI
19-
```shell
20-
buildstamp [opts]
21-
```
2237
| Flag | Description | Default |
2338
|-------------|-----------------------------|-------------------|
2439
| `--output` | Buildstamp file destination | `buildstamp.json` |
@@ -28,5 +43,26 @@ buildstamp [opts]
2843
| `--date` | Attach ISO8601 date | `true` |
2944
| `--extra` | JSON mixin to inject | `{}` |
3045

46+
### Go API
47+
```go
48+
package main
49+
50+
import (
51+
"github.com/qiwi/buildstamp/packages/bin/src/main/go/buildstamp"
52+
"log"
53+
)
54+
55+
func main() {
56+
var opts = buildstamp.BuildstampOpts{
57+
true,
58+
true,
59+
true,
60+
"{}",
61+
"/Users/antongolub/projects/test",
62+
}
63+
log.Print(buildstamp.GetBuildstamp(opts))
64+
}
65+
```
66+
3167
## License
3268
[MIT](./LICENSE)

0 commit comments

Comments
 (0)