Skip to content

Commit cc8181d

Browse files
committed
harbor-cli 0.0.14 (new formula)
Signed-off-by: Rui Chen <[email protected]>
1 parent 09d7875 commit cc8181d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Formula/h/harbor-cli.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
class HarborCli < Formula
2+
desc "CLI for Harbor container registry"
3+
homepage "https://github.com/goharbor/harbor-cli"
4+
url "https://github.com/goharbor/harbor-cli/archive/refs/tags/v0.0.14.tar.gz"
5+
sha256 "a0518de7b09f0aac262a556d51a149841846dc85a5a4a1eebe79b6da68b6468b"
6+
license "Apache-2.0"
7+
head "https://github.com/goharbor/harbor-cli.git", branch: "main"
8+
9+
depends_on "go" => :build
10+
11+
def install
12+
ldflags = %W[
13+
-s -w
14+
-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=#{version}
15+
-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GoVersion=#{Formula["go"].version}
16+
-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit=#{tap.user}
17+
-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.BuildTime=#{time.iso8601}
18+
]
19+
system "go", "build", *std_go_args(ldflags:, output: bin/"harbor"), "./cmd/harbor"
20+
21+
generate_completions_from_executable(bin/"harbor", "completion", shells: [:bash, :zsh, :fish, :pwsh])
22+
end
23+
24+
test do
25+
assert_match version.to_s, shell_output("#{bin}/harbor version")
26+
27+
output = shell_output("#{bin}/harbor repo list 2>&1", 1)
28+
assert_match "Error: failed to get project name", output
29+
end
30+
end

0 commit comments

Comments
 (0)