From 45848eee7d06c50ac361c88e57aea95467aec809 Mon Sep 17 00:00:00 2001 From: Rocktavious Date: Thu, 31 Aug 2023 19:50:04 -0500 Subject: [PATCH] remove the service command --- src/cmd/import.go | 2 +- src/cmd/preview.go | 14 ++++++++++---- src/cmd/reconcile.go | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmd/import.go b/src/cmd/import.go index 567df1ed..710775e7 100644 --- a/src/cmd/import.go +++ b/src/cmd/import.go @@ -20,7 +20,7 @@ var importCmd = &cobra.Command{ } func init() { - serviceCmd.AddCommand(importCmd) + rootCmd.AddCommand(importCmd) } func runImport(cmd *cobra.Command, args []string) { diff --git a/src/cmd/preview.go b/src/cmd/preview.go index d8a8c6bf..335c4ccd 100644 --- a/src/cmd/preview.go +++ b/src/cmd/preview.go @@ -28,7 +28,7 @@ If SAMPLES_COUNT=0 this will print out everything.`, } func init() { - serviceCmd.AddCommand(previewCmd) + rootCmd.AddCommand(previewCmd) } func runPreview(cmd *cobra.Command, args []string) { @@ -51,7 +51,9 @@ func runPreview(cmd *cobra.Command, args []string) { samples = servicesCount } - if IsTextOutput() { fmt.Print("The following data was found in your Kubernetes cluster ...\n\n") } + if IsTextOutput() { + fmt.Print("The following data was found in your Kubernetes cluster ...\n\n") + } if len(services) == 0 { fmt.Printf("[]\n") } else { @@ -61,11 +63,15 @@ func runPreview(cmd *cobra.Command, args []string) { } fmt.Printf("%s\n", string(prettyJSON)) if samples < servicesCount { - if IsTextOutput() { fmt.Printf("\nShowing %v / %v resources\n", samples, servicesCount) } + if IsTextOutput() { + fmt.Printf("\nShowing %v / %v resources\n", samples, servicesCount) + } } } - if IsTextOutput() { fmt.Println("\nIf you're happy with the above data you can reconcile it with OpsLevel by running:\n\n OPSLEVEL_API_TOKEN=XXX kubectl opslevel service import\n\nOtherwise, please adjust the config file and rerun this command") } + if IsTextOutput() { + fmt.Println("\nIf you're happy with the above data you can reconcile it with OpsLevel by running:\n\n OPSLEVEL_API_TOKEN=XXX kubectl opslevel service import\n\nOtherwise, please adjust the config file and rerun this command") + } } func sample(data []common.ServiceRegistration, samples int) []common.ServiceRegistration { diff --git a/src/cmd/reconcile.go b/src/cmd/reconcile.go index da590be5..06a2168e 100644 --- a/src/cmd/reconcile.go +++ b/src/cmd/reconcile.go @@ -27,7 +27,7 @@ var reconcileCmd = &cobra.Command{ } func init() { - serviceCmd.AddCommand(reconcileCmd) + rootCmd.AddCommand(reconcileCmd) reconcileCmd.Flags().IntVar(&reconcileResyncInterval, "resync", 24, "The amount (in hours) before a full resync of the kubernetes cluster happens with OpsLevel. [default: 24]") reconcileCmd.Flags().IntVar(&reconcileBatchSize, "batch", 500, "The max amount of k8s resources to batch process with jq. Helps to speedup initial startup. [default: 500]")