Provide two usage mode - standalone and kubectl#49
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the project to support two usage modes from a single binary: a standalone CLI (cococtl) and a kubectl plugin invocation (kubectl coco) via symlinks, aligning the documentation and build/install workflow with the new primary binary name.
Changes:
- Renames the primary built binary to
cococtland installskubectl-coco/kubectl_complete-cocoas symlinks. - Updates CLI root command naming behavior based on the invoked binary name (standalone vs plugin).
- Refreshes README installation and completion instructions for the two invocation styles.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| README.md | Updates docs to describe cococtl as the primary binary and explains standalone vs kubectl plugin usage and completion setup. |
| Makefile | Builds cococtl and installs symlinks for kubectl-coco and kubectl_complete-coco. |
| cmd/root.go | Adjusts Cobra root command Use based on invocation name to support both modes. |
| cmd/completion.go | Reworks completion generation to support both command names and documents plugin completion behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,7 +1,9 @@ | |||
| .PHONY: build install clean test eval eval-offline help release release-all lint | |||
Comment on lines
+111
to
113
| // Determine the __start_<name> function cobra registered above. | ||
| startFn := "__start_" + rootCmd.Use | ||
|
|
| ``` | ||
|
|
||
| **Installation:** | ||
| **Step 2 — Install cococtl completion** (covers `cococtl`, `kubectl-coco`, `kubectl_coco`): |
Comment on lines
+20
to
+23
| There are two independent completion mechanisms: | ||
|
|
||
| Install bash-completion. | ||
| 1. Generated script — covers 'cococtl', 'kubectl-coco', and 'kubectl_coco'. | ||
| Source this file once (see below). |
| ``` | ||
|
|
||
| Install kubectl-coco completion: | ||
| **Step 2 — Install cococtl completion** (covers `cococtl`, `kubectl-coco`, `kubectl_coco`): |
Comment on lines
+78
to
+80
| Install completion (covers cococtl, kubectl-coco, and kubectl_coco): | ||
| $ cococtl completion zsh > "${fpath[1]}/_cococtl" | ||
|
|
Comment on lines
+51
to
+53
| @echo "Installation complete." | ||
| @echo " Standalone CLI : cococtl" | ||
| @echo " kubectl plugin : kubectl coco" |
The binary name is cococtl for standalone. Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The binary name is cococtl for standalone.