From ffdfbb0bfaceab5a18a859aecb206daa6e7dc58d Mon Sep 17 00:00:00 2001 From: Daichi Sakaue Date: Thu, 17 Oct 2024 10:23:16 +0900 Subject: [PATCH] Move CLI entry point Signed-off-by: Daichi Sakaue --- Makefile | 2 +- cmd/npv/main.go | 7 +++++++ cmd/{ => npv/sub}/dump.go | 2 +- cmd/{ => npv/sub}/helper.go | 2 +- cmd/{ => npv/sub}/list.go | 2 +- cmd/{ => npv/sub}/root.go | 2 +- main.go | 9 --------- 7 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 cmd/npv/main.go rename cmd/{ => npv/sub}/dump.go (98%) rename cmd/{ => npv/sub}/helper.go (99%) rename cmd/{ => npv/sub}/list.go (99%) rename cmd/{ => npv/sub}/root.go (98%) delete mode 100644 main.go diff --git a/Makefile b/Makefile index ba4dfdb..a4d5f0e 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ clean: .PHONY: build build: ## Build network-policy-viewer mkdir -p $(BIN_DIR) - go build -trimpath -ldflags "-w -s" -o $(BIN_DIR)/npv main.go + go build -trimpath -ldflags "-w -s" -o $(BIN_DIR)/npv ./cmd/npv .PHONY: check-generate check-generate: diff --git a/cmd/npv/main.go b/cmd/npv/main.go new file mode 100644 index 0000000..b1b4e9d --- /dev/null +++ b/cmd/npv/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/cybozu-go/network-policy-viewer/cmd/npv/sub" + +func main() { + sub.Execute() +} diff --git a/cmd/dump.go b/cmd/npv/sub/dump.go similarity index 98% rename from cmd/dump.go rename to cmd/npv/sub/dump.go index 8c0b274..56d0d88 100644 --- a/cmd/dump.go +++ b/cmd/npv/sub/dump.go @@ -1,4 +1,4 @@ -package cmd +package sub import ( "bytes" diff --git a/cmd/helper.go b/cmd/npv/sub/helper.go similarity index 99% rename from cmd/helper.go rename to cmd/npv/sub/helper.go index 7f0c40f..044f5d0 100644 --- a/cmd/helper.go +++ b/cmd/npv/sub/helper.go @@ -1,4 +1,4 @@ -package cmd +package sub import ( "context" diff --git a/cmd/list.go b/cmd/npv/sub/list.go similarity index 99% rename from cmd/list.go rename to cmd/npv/sub/list.go index fd884d9..ed8d91d 100644 --- a/cmd/list.go +++ b/cmd/npv/sub/list.go @@ -1,4 +1,4 @@ -package cmd +package sub import ( "context" diff --git a/cmd/root.go b/cmd/npv/sub/root.go similarity index 98% rename from cmd/root.go rename to cmd/npv/sub/root.go index d97d6a8..6d6efd5 100644 --- a/cmd/root.go +++ b/cmd/npv/sub/root.go @@ -1,4 +1,4 @@ -package cmd +package sub import ( "fmt" diff --git a/main.go b/main.go deleted file mode 100644 index 8b925ad..0000000 --- a/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "github.com/cybozu-go/network-policy-viewer/cmd" -) - -func main() { - cmd.Execute() -}