Skip to content

Commit 339e059

Browse files
Merge pull request #20 from miguelmartens/fix/version-subcommand
Add Homebrew documentation for versioning
2 parents 79d6742 + 426fa6f commit 339e059

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

docs/FEATURES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ See [POLICY-ENFORCEMENT.md](POLICY-ENFORCEMENT.md) for the rationale and impleme
4444
| Diff | `--diff=<id>` — key-by-key difference (current vs preset) |
4545
| Export | `--export=<path>` — current settings to YAML |
4646
| Reset | `--reset`, `-r` |
47-
| Current settings | `--current`, `-c` — print current Brave policy settings |
47+
| Current settings | `--current`, `-c` — print current Brave policy settings |
4848
| Backups | `--backups`, `-b` (list), `--restore=<path>`, `--delete-backup=<path>` |
4949
| Help | `--help`, `-h` |
5050

docs/HOMEBREW.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Homebrew tap — version ldflag
2+
3+
The binary shows its version with `cowardly version` or `cowardly -v`. To avoid showing `dev`, the **Homebrew formula must inject the version** at build time.
4+
5+
In the tap repo [miguelmartens/homebrew-cowardly](https://github.com/miguelmartens/homebrew-cowardly), ensure the formula passes the version in ldflags:
6+
7+
```ruby
8+
def install
9+
ldflags = "-s -w -X main.Version=v#{version}"
10+
system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/cowardly"
11+
end
12+
```
13+
14+
So the built binary reports e.g. `Cowardly version: v0.2.5` instead of `Cowardly version: dev`. Homebrew’s `version` is taken from the tag in the tarball URL (e.g. `v0.2.5``version` is `0.2.5`), hence `v#{version}`.

0 commit comments

Comments
 (0)