Skip to content

Commit 0c1d836

Browse files
Initial release of Chargebee CLI
0 parents  commit 0c1d836

46 files changed

Lines changed: 4749 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: "1.23"
21+
- uses: golangci/golangci-lint-action@v7
22+
with:
23+
version: v2.5
24+
25+
test:
26+
name: Test
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-go@v5
31+
with:
32+
go-version: "1.23"
33+
- run: go test -v -race ./...
34+
35+
build:
36+
name: Build
37+
runs-on: ubuntu-latest
38+
needs: [lint, test]
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-go@v5
42+
with:
43+
go-version: "1.23"
44+
- run: go build -o bin/cb ./cmd/cb

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.23"
22+
- uses: goreleaser/goreleaser-action@v6
23+
with:
24+
version: latest
25+
args: release --clean
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Binaries
2+
bin/
3+
*.exe
4+
*.dll
5+
*.so
6+
*.dylib
7+
*.test
8+
*.out
9+
10+
# IDE
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*~
15+
16+
# Environment & secrets
17+
.env
18+
19+
# OS
20+
.DS_Store
21+
22+
# Goreleaser
23+
dist/
24+
25+
# Coverage
26+
coverage.txt

.golangci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "2"
2+
3+
linters:
4+
enable:
5+
- errcheck
6+
- staticcheck
7+
- govet
8+
- gosec
9+
- ineffassign
10+
- unused
11+
- misspell
12+
13+
formatters:
14+
enable:
15+
- goimports
16+
settings:
17+
goimports:
18+
local-prefixes:
19+
- github.com/jhuiting/chargebee-cli

.goreleaser.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: 2
2+
3+
builds:
4+
- main: ./cmd/cb
5+
binary: cb
6+
env:
7+
- CGO_ENABLED=0
8+
ldflags:
9+
- -s -w
10+
- -X github.com/jhuiting/chargebee-cli/internal/version.Version={{.Version}}
11+
- -X github.com/jhuiting/chargebee-cli/internal/version.Commit={{.ShortCommit}}
12+
- -X github.com/jhuiting/chargebee-cli/internal/version.Date={{.Date}}
13+
goos:
14+
- linux
15+
- darwin
16+
- windows
17+
goarch:
18+
- amd64
19+
- arm64
20+
21+
archives:
22+
- formats:
23+
- tar.gz
24+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
25+
format_overrides:
26+
- goos: windows
27+
formats:
28+
- zip
29+
30+
checksum:
31+
name_template: "checksums.txt"
32+
33+
changelog:
34+
sort: asc
35+
filters:
36+
exclude:
37+
- "^docs:"
38+
- "^test:"
39+
- "^ci:"
40+
41+
homebrew_casks:
42+
- name: chargebee-cli
43+
repository:
44+
owner: jhuiting
45+
name: homebrew-tap
46+
branch: "update/chargebee-cli-{{ .Version }}"
47+
pull_request:
48+
enabled: true
49+
base:
50+
owner: jhuiting
51+
name: homebrew-tap
52+
branch: main
53+
binary: cb
54+
homepage: "https://github.com/jhuiting/chargebee-cli"
55+
description: "Chargebee CLI — develop, test, and manage your Chargebee integration"
56+
license: "MIT"

CONTRIBUTORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributors
2+
3+
- Jos Huiting — creator and initial implementation

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-2026 Jos Huiting
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
MODULE := github.com/jhuiting/chargebee-cli
2+
BINARY := cb
3+
BUILD_DIR := bin
4+
5+
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
6+
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
7+
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
8+
9+
LDFLAGS := -s -w \
10+
-X $(MODULE)/internal/version.Version=$(VERSION) \
11+
-X $(MODULE)/internal/version.Commit=$(COMMIT) \
12+
-X $(MODULE)/internal/version.Date=$(DATE)
13+
14+
.PHONY: build lint fmt verify test deps clean
15+
16+
build:
17+
@go build -ldflags '$(LDFLAGS)' -o $(BUILD_DIR)/$(BINARY) ./cmd/cb
18+
19+
lint:
20+
@golangci-lint run
21+
22+
fmt:
23+
@go fmt ./...
24+
@goimports -w -local $(MODULE) .
25+
26+
verify: fmt lint build
27+
@echo "✅ Code verification complete"
28+
29+
test:
30+
@go test -v ./...
31+
32+
deps:
33+
@go mod download
34+
@go mod tidy
35+
36+
clean:
37+
@rm -rf $(BUILD_DIR)

0 commit comments

Comments
 (0)