Skip to content

Commit 4cc6e60

Browse files
authored
Merge pull request #49 from bpradipt/multi-use
Provide two usage mode - standalone and kubectl
2 parents a612664 + 4a05f38 commit 4cc6e60

4 files changed

Lines changed: 257 additions & 183 deletions

File tree

Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
.PHONY: build install clean test eval eval-offline help release release-all lint
1+
.PHONY: all build install uninstall clean test eval eval-offline tidy fmt vet lint deps help release release-all
22

3-
# Binary name
4-
BINARY_NAME=kubectl-coco
3+
# Primary binary name (standalone CLI)
4+
BINARY_NAME=cococtl
5+
# kubectl plugin binary name (symlinked from BINARY_NAME during install)
6+
KUBECTL_PLUGIN_NAME=kubectl-coco
57

68
# Installation path
79
INSTALL_PATH=/usr/local/bin
@@ -32,25 +34,29 @@ RELEASE_BINARY=$(BINARY_NAME)-$(GOOS)-$(GOARCH)
3234
# Default target
3335
all: build
3436

35-
## build: Build the kubectl-coco binary
37+
## build: Build the cococtl binary
3638
build:
3739
@echo "Building $(BINARY_NAME) (version: $(VERSION))..."
3840
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) .
3941
@echo "Build complete: $(BINARY_NAME)"
4042

41-
## install: Install kubectl-coco to $(INSTALL_PATH)
43+
## install: Install cococtl and kubectl-coco symlink to $(INSTALL_PATH)
4244
install: build
4345
@echo "Installing $(BINARY_NAME) to $(INSTALL_PATH)..."
4446
@mkdir -p $(INSTALL_PATH)
4547
@cp $(BINARY_NAME) $(INSTALL_PATH)/
4648
@chmod +x $(INSTALL_PATH)/$(BINARY_NAME)
49+
@ln -sf $(INSTALL_PATH)/$(BINARY_NAME) $(INSTALL_PATH)/$(KUBECTL_PLUGIN_NAME)
4750
@ln -sf $(INSTALL_PATH)/$(BINARY_NAME) $(INSTALL_PATH)/kubectl_complete-coco
48-
@echo "Installation complete. You can now use: kubectl coco"
51+
@echo "Installation complete."
52+
@echo " Standalone CLI : $(BINARY_NAME)"
53+
@echo " kubectl plugin : kubectl coco (via $(KUBECTL_PLUGIN_NAME) symlink)"
4954

50-
## uninstall: Remove kubectl-coco from $(INSTALL_PATH)
55+
## uninstall: Remove cococtl, kubectl-coco, and completion symlink from $(INSTALL_PATH)
5156
uninstall:
5257
@echo "Uninstalling $(BINARY_NAME)..."
5358
@rm -f $(INSTALL_PATH)/$(BINARY_NAME)
59+
@rm -f $(INSTALL_PATH)/$(KUBECTL_PLUGIN_NAME)
5460
@rm -f $(INSTALL_PATH)/kubectl_complete-coco
5561
@echo "Uninstall complete"
5662

0 commit comments

Comments
 (0)