From 2e50ff7b4171b15e3c7cab230a5af461d49a08b8 Mon Sep 17 00:00:00 2001 From: lauk001 Date: Thu, 9 Nov 2023 09:46:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E4=B8=BB=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/cmd.go => nkd.go | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) rename cmd/cmd.go => nkd.go (55%) diff --git a/cmd/cmd.go b/nkd.go similarity index 55% rename from cmd/cmd.go rename to nkd.go index 2f0e78c..6d259b4 100755 --- a/cmd/cmd.go +++ b/nkd.go @@ -13,27 +13,38 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package cmd +package main import ( - "io" + "nestos-kubernetes-deployer/cmd" "github.com/spf13/cobra" ) -func NewNkdCommand(in io.Reader, out, err io.Writer) *cobra.Command { - cmds := &cobra.Command{ - Use: "nkd", - Short: "nkd: easily bootstrap a secure Kubernetes cluster", +func main() { + rootCmd := newRootCmd() + + for _, subCmd := range []*cobra.Command{ + // cmd.ResetFlags(), + cmd.NewDeployCommand(), + cmd.NewDestroyCommand(), + cmd.NewUpgradeCommand(), + // TODO: 当前extend是指扩展到的worker节点个数,后续应改成想扩展的worker节点个数。 + cmd.NewExtendCommand(), + cmd.NewVersionCommand(), + } { + rootCmd.AddCommand(subCmd) } - cmds.ResetFlags() - cmds.AddCommand(NewDeployCommand()) - cmds.AddCommand(NewDestroyCommand()) - cmds.AddCommand(NewUpgradeCommand()) - // TODO: 当前extend是指扩展到的worker节点个数,后续应改成想扩展的worker节点个数。 - cmds.AddCommand(NewExtendCommand()) - cmds.AddCommand(NewVersionCommand()) + if err := rootCmd.Execute(); err != nil { + return + } +} - return cmds +func newRootCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "nkd", + Short: "nkd: easily bootstrap a secure Kubernetes cluster", + } + return cmd } -- Gitee