Skip to content

Commit

Permalink
misc: add support to install with homebrew (#56)
Browse files Browse the repository at this point in the history
for now we provide homebrew formula from within xx4h/hctl
github repo, as we need at least 30 watchers, 30 forks, or
75 stars on the xx4h/hctl repostory until we can add
the formula to Homebrew/homebrew-core
  • Loading branch information
xx4h authored Oct 15, 2024
1 parent e4fc037 commit 55ad95a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/linter-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
VALIDATE_ALL_CODEBASE: true
VALIDATE_JSCPD: false
VALIDATE_GO: false
VALIDATE_RUBY: false
FILTER_REGEX_EXCLUDE: .*\.github/linters/\.golangci\.yml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/linter-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
VALIDATE_ALL_CODEBASE: false
VALIDATE_JSCPD: false
VALIDATE_GO: false
VALIDATE_RUBY: false
FILTER_REGEX_EXCLUDE: .*\.github/linters/\.golangci\.yml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions Formula/hctl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class Hctl < Formula
desc "Tool to control your Home Assistant devices from the command-line"
homepage "https://github.com/xx4h/hctl"
url "https://github.com/xx4h/hctl.git",
tag: "v0.4.0",
revision: "e4fc037a284d28a7519ac1512d5201a2620ff623"
license "Apache-2.0"
head "https://github.com/xx4h/hctl.git", branch: "main"

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

depends_on "go" => :build

def install
ldflags = %W[
-s -w
-X github.com/xx4h/hctl/cmd.version=v#{version}
-X github.com/xx4h/hctl/cmd.commit=#{Utils.git_head}
-X github.com/xx4h/hctl/cmd.date=#{time.iso8601}
]
system "go", "build", *std_go_args(ldflags:)

generate_completions_from_executable(bin/"hctl", "completion")
end

test do
assert_match "Hctl is a CLI tool to control your home automation", shell_output("#{bin}/hctl --help")
end
end
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ And here we are!

## Install

### Homebrew

```bash
brew tap xx4h/hctl
brew install xx4h/hctl/hctl
```

### asdf

```bash
Expand Down

0 comments on commit 55ad95a

Please sign in to comment.