Skip to content

Commit 22beffb

Browse files
feat: improve CLI documentation, add Makefile for build automation, and update .gitignore
1 parent eaa19d3 commit 22beffb

3 files changed

Lines changed: 88 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ bin/
1313

1414
# Temporary CI release notes
1515
release_notes.md
16+
./bin/*

Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.PHONY: all build test clean gateway serve vet fmt check-deps help
2+
3+
BINARY_DIR=bin
4+
CLI_BINARY=$(BINARY_DIR)/breez
5+
GATEWAY_BINARY=$(BINARY_DIR)/gateway
6+
7+
# Default target
8+
all: build test
9+
10+
## build: Build both CLI and Gateway binaries into ./bin
11+
build:
12+
@mkdir -p $(BINARY_DIR)
13+
@echo "Building Breez CLI..."
14+
@go build -v -o $(CLI_BINARY) ./cmd/breez
15+
@echo "Building Breez Gateway..."
16+
@go build -v -o $(GATEWAY_BINARY) ./cmd/gateway
17+
@echo "✔ Binaries successfully built in $(BINARY_DIR)/"
18+
19+
## test: Run unit and integration test suite
20+
test:
21+
@echo "Running tests..."
22+
@go test -v -race ./...
23+
24+
## vet: Run static analysis / go vet
25+
vet:
26+
@echo "Running go vet..."
27+
@go vet ./...
28+
29+
## fmt: Format all Go source files
30+
fmt:
31+
@echo "Formatting code..."
32+
@gofmt -s -w .
33+
34+
## check-deps: Tidy and verify go.mod dependencies
35+
check-deps:
36+
@echo "Tidying go.mod..."
37+
@go mod tidy
38+
@go mod verify
39+
40+
## gateway: Run Gateway server locally on port 8080
41+
gateway: build
42+
@echo "Starting local Gateway server on :8080..."
43+
@./$(GATEWAY_BINARY) --domain breez.localhost --port 8080
44+
45+
## serve: Run CLI tunnel serving local port 3000 (Usage: make serve PORT=3000)
46+
PORT ?= 3000
47+
serve: build
48+
@echo "Starting Breez CLI serving port $(PORT)..."
49+
@./$(CLI_BINARY) serve $(PORT) --gateway http://localhost:8080
50+
51+
## clean: Remove built binaries and temporary test files
52+
clean:
53+
@echo "Cleaning binaries..."
54+
@rm -rf $(BINARY_DIR)
55+
@rm -f release_notes.md
56+
@echo "✔ Clean completed."
57+
58+
## help: Show list of available Makefile commands
59+
help:
60+
@echo "Usage: make [target]"
61+
@echo ""
62+
@echo "Targets:"
63+
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':'

cmd/breez/main.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,48 @@ var (
1818
func main() {
1919
rootCmd := &cobra.Command{
2020
Use: "breez",
21-
Short: "Breez - Instant local tunnel CLI",
22-
Long: "Expose your local development servers to the internet securely via Breez.",
21+
Short: "Breez - Instant, lightweight local tunnel CLI",
22+
Long: `☁ Breez CLI
23+
Expose your local development HTTP servers to the public internet instantly.
24+
25+
Examples:
26+
$ breez serve 3000
27+
$ breez serve 8080 --subdomain myapp
28+
$ breez serve 5173 --gateway https://gateway.breez.run`,
2329
}
2430

25-
rootCmd.PersistentFlags().StringVar(&gatewayURL, "gateway", "http://localhost:8080", "Gateway server URL")
31+
rootCmd.PersistentFlags().StringVarP(&gatewayURL, "gateway", "g", "http://localhost:8080", "Gateway server URL to connect with")
2632

2733
serveCmd := &cobra.Command{
2834
Use: "serve <port>",
29-
Short: "Serve a local port over a public URL tunnel",
30-
Args: cobra.ExactArgs(1),
35+
Short: "Create a public tunnel forwarding to your local HTTP server port",
36+
Long: `Creates a secure WebSocket tunnel between your local port and the Breez Gateway server.
37+
38+
Arguments:
39+
<port> The local port number where your application/server is running (e.g. 3000, 8080, 5173).
40+
41+
Examples:
42+
$ breez serve 3000
43+
$ breez serve 8080 --subdomain custom-name
44+
$ breez serve 5000 --gateway http://localhost:8080`,
45+
Args: cobra.ExactArgs(1),
3146
RunE: func(cmd *cobra.Command, args []string) error {
3247
port, err := strconv.Atoi(args[0])
3348
if err != nil || port <= 0 || port > 65535 {
34-
return fmt.Errorf("invalid port number: %s", args[0])
49+
return fmt.Errorf("invalid port number: %s. Port must be an integer between 1 and 65535", args[0])
3550
}
3651

3752
client := cli.NewClient(gatewayURL, port, subdomain)
3853
return client.Serve()
3954
},
4055
}
4156

42-
serveCmd.Flags().StringVarP(&subdomain, "subdomain", "s", "", "Request a specific subdomain")
57+
serveCmd.Flags().StringVarP(&subdomain, "subdomain", "s", "", "Request a custom subdomain name (e.g. --subdomain myapp)")
4358

4459
versionCmd := &cobra.Command{
4560
Use: "version",
46-
Short: "Display CLI version information",
61+
Short: "Display version, commit hash, and build timestamp",
62+
Long: "Displays the current installed Breez CLI version, git commit hash, and build timestamp.",
4763
Run: func(cmd *cobra.Command, args []string) {
4864
fmt.Printf("breez v%s (commit: %s, built at: %s)\n", version.Version, version.Commit, version.BuildDate)
4965
},

0 commit comments

Comments
 (0)