From 019cfa518227b3814e4dfe59fe2ae3780496f64a Mon Sep 17 00:00:00 2001 From: hanshal101 <82961842+hanshal101@users.noreply.github.com> Date: Sat, 6 Apr 2024 22:20:51 +0530 Subject: [PATCH 1/3] feat(cli): initialization of the cyctl cli --- cyctl/cmd/root.go | 15 +++++++++++++++ cyctl/cmd/version.go | 22 ++++++++++++++++++++++ cyctl/go.mod | 10 ++++++++++ cyctl/go.sum | 10 ++++++++++ cyctl/main.go | 15 +++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 cyctl/cmd/root.go create mode 100644 cyctl/cmd/version.go create mode 100644 cyctl/go.mod create mode 100644 cyctl/go.sum create mode 100644 cyctl/main.go diff --git a/cyctl/cmd/root.go b/cyctl/cmd/root.go new file mode 100644 index 00000000..1cca8344 --- /dev/null +++ b/cyctl/cmd/root.go @@ -0,0 +1,15 @@ +package cmd + +import ( + "github.com/spf13/cobra" +) + +var ( + RootCmd = cobra.Command{ + Use: "cyctl", + Version: "v0.2.0", + Short: "👁️ Customizable UI for Kubernetes Workloads", + Long: "Cyclops gives you a UI containing fields you define yourself to manage your K8s workloads.", + PersistentPreRun: func(cmd *cobra.Command, args []string) {}, + } +) diff --git a/cyctl/cmd/version.go b/cyctl/cmd/version.go new file mode 100644 index 00000000..4362dea7 --- /dev/null +++ b/cyctl/cmd/version.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var versionCMD = &cobra.Command{ + Use: "version", + Short: "Prints the version of cyctl", + Long: "Prints the version of cyctl", + Run: func(cmd *cobra.Command, args []string) { + var version = RootCmd.Version + fmt.Fprintf(os.Stderr, "%s\n", version) + }, +} + +func init() { + RootCmd.AddCommand(versionCMD) +} diff --git a/cyctl/go.mod b/cyctl/go.mod new file mode 100644 index 00000000..544d1a4e --- /dev/null +++ b/cyctl/go.mod @@ -0,0 +1,10 @@ +module github.com/cyclops-ui/cycops-cyctl + +go 1.21.5 + +require github.com/spf13/cobra v1.8.0 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect +) diff --git a/cyctl/go.sum b/cyctl/go.sum new file mode 100644 index 00000000..d0e8c2c3 --- /dev/null +++ b/cyctl/go.sum @@ -0,0 +1,10 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cyctl/main.go b/cyctl/main.go new file mode 100644 index 00000000..7c0b1c5e --- /dev/null +++ b/cyctl/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "os" + + "github.com/cyclops-ui/cycops-cyctl/cmd" +) + +func main() { + if err := cmd.RootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} From 84d8e6b3966c5a96757758c016771c689066a422 Mon Sep 17 00:00:00 2001 From: hanshal101 <82961842+hanshal101@users.noreply.github.com> Date: Sat, 6 Apr 2024 22:26:05 +0530 Subject: [PATCH 2/3] feat(cli): initialization of the cyctl cli --- cyctl/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 cyctl/.gitignore diff --git a/cyctl/.gitignore b/cyctl/.gitignore new file mode 100644 index 00000000..78001022 --- /dev/null +++ b/cyctl/.gitignore @@ -0,0 +1 @@ +go.mod \ No newline at end of file From d20b8ff352be5c153bee3902920984a53df385f0 Mon Sep 17 00:00:00 2001 From: hanshal101 <82961842+hanshal101@users.noreply.github.com> Date: Sat, 6 Apr 2024 22:27:17 +0530 Subject: [PATCH 3/3] feat(cli): initialization of the cyctl cli --- cyctl/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 cyctl/.gitignore diff --git a/cyctl/.gitignore b/cyctl/.gitignore deleted file mode 100644 index 78001022..00000000 --- a/cyctl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -go.mod \ No newline at end of file