From 9d93573aac5068731945ebd34ad5fb7a99909b02 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Fri, 25 Oct 2024 18:29:29 +0200 Subject: [PATCH] docs(clustertool): add more in-code documentation --- clustertool/cmd/adv.go | 1 + clustertool/cmd/adv_bootstrap.go | 9 +++++---- clustertool/cmd/adv_health.go | 7 ++++--- clustertool/cmd/adv_precommit.go | 7 ++++--- clustertool/cmd/adv_reset.go | 7 ++++--- clustertool/cmd/adv_testcmd.go | 4 ++-- clustertool/cmd/apply.go | 7 ++++--- clustertool/cmd/charts.go | 9 ++++----- clustertool/cmd/charts_bump.go | 2 +- clustertool/cmd/charts_deps.go | 2 +- clustertool/cmd/charts_genchangelog.go | 2 +- clustertool/cmd/charts_genchartlist.go | 2 +- clustertool/cmd/charts_genmeta.go | 7 ++++--- clustertool/cmd/charts_tagclean.go | 2 +- clustertool/cmd/checkcrypt.go | 7 ++++--- clustertool/cmd/decrypt.go | 7 ++++--- clustertool/cmd/encrypt.go | 7 ++++--- clustertool/cmd/fluxbootstrap.go | 7 ++++--- clustertool/cmd/helmrelease.go | 5 +++-- clustertool/cmd/helmrelease_install.go | 7 ++++--- clustertool/cmd/helmrelease_upgrade.go | 7 ++++--- clustertool/cmd/info.go | 9 +++++++++ clustertool/cmd/init.go | 1 - clustertool/cmd/root.go | 18 +----------------- clustertool/cmd/scale.go | 5 ++++- clustertool/cmd/scale_export.go | 7 ++++--- clustertool/cmd/scale_migrate.go | 7 ++++--- clustertool/cmd/upgrade.go | 7 ++++--- 28 files changed, 90 insertions(+), 79 deletions(-) diff --git a/clustertool/cmd/adv.go b/clustertool/cmd/adv.go index 673f6c635c53..18bacb9eb565 100644 --- a/clustertool/cmd/adv.go +++ b/clustertool/cmd/adv.go @@ -14,6 +14,7 @@ These are all advanced commands that should generally not be needed var adv = &cobra.Command{ Use: "adv", Short: "Advanced cluster maintanence commands", + Example: "clustertool adv ", Long: advLongHelp, SilenceUsage: true, SilenceErrors: true, diff --git a/clustertool/cmd/adv_bootstrap.go b/clustertool/cmd/adv_bootstrap.go index fed6f97776e4..54dfc5821474 100644 --- a/clustertool/cmd/adv_bootstrap.go +++ b/clustertool/cmd/adv_bootstrap.go @@ -12,10 +12,11 @@ var advBootstrapLongHelp = strings.TrimSpace(` `) var bootstrap = &cobra.Command{ - Use: "bootstrap", - Short: "bootstrap first Talos Node", - Long: advBootstrapLongHelp, - Run: bootstrapfunc, + Use: "bootstrap", + Short: "bootstrap first Talos Node", + Example: "clustertool adv bootstrap", + Long: advBootstrapLongHelp, + Run: bootstrapfunc, } func bootstrapfunc(cmd *cobra.Command, args []string) { diff --git a/clustertool/cmd/adv_health.go b/clustertool/cmd/adv_health.go index d5e33d9af884..2a2cf558e0bc 100644 --- a/clustertool/cmd/adv_health.go +++ b/clustertool/cmd/adv_health.go @@ -15,9 +15,10 @@ var advHealthLongHelp = strings.TrimSpace(` `) var health = &cobra.Command{ - Use: "health", - Short: "Check Talos Cluster Health", - Long: advHealthLongHelp, + Use: "health", + Short: "Check Talos Cluster Health", + Example: "clustertool adv health", + Long: advHealthLongHelp, Run: func(cmd *cobra.Command, args []string) { if err := sops.DecryptFiles(); err != nil { log.Info().Msgf("Error decrypting files: %v\n", err) diff --git a/clustertool/cmd/adv_precommit.go b/clustertool/cmd/adv_precommit.go index 59dd3834a561..db11a1bff15f 100644 --- a/clustertool/cmd/adv_precommit.go +++ b/clustertool/cmd/adv_precommit.go @@ -14,9 +14,10 @@ var advPrecommitLongHelp = strings.TrimSpace(` `) var precommit = &cobra.Command{ - Use: "precommit", - Short: "Runs the PreCommit encryption check", - Long: advPrecommitLongHelp, + Use: "precommit", + Short: "Runs the PreCommit encryption check", + Example: "clustertool adv precommit", + Long: advPrecommitLongHelp, Run: func(cmd *cobra.Command, args []string) { if err := sops.CheckFilesAndReportEncryption(true, true); err != nil { log.Info().Msgf("Error checking files: %v\n", err) diff --git a/clustertool/cmd/adv_reset.go b/clustertool/cmd/adv_reset.go index 8e3ab4b39f9d..12806a29af13 100644 --- a/clustertool/cmd/adv_reset.go +++ b/clustertool/cmd/adv_reset.go @@ -14,9 +14,10 @@ var advResetLongHelp = strings.TrimSpace(` `) var reset = &cobra.Command{ - Use: "reset", - Short: "Reset Talos Nodes and Kubernetes", - Long: advResetLongHelp, + Use: "reset", + Short: "Reset Talos Nodes and Kubernetes", + Example: "clustertool adv reset ", + Long: advResetLongHelp, Run: func(cmd *cobra.Command, args []string) { var extraArgs []string node := "" diff --git a/clustertool/cmd/adv_testcmd.go b/clustertool/cmd/adv_testcmd.go index f9ca2ead05b8..aace297a4f46 100644 --- a/clustertool/cmd/adv_testcmd.go +++ b/clustertool/cmd/adv_testcmd.go @@ -10,12 +10,12 @@ import ( ) var advTestCmdlongHelp = strings.TrimSpace(` - +This command is mostly just for development usage and should NEVER be used by end-users. `) var testcmd = &cobra.Command{ Use: "test", - Short: "test run", + Short: "tests specific code for developer usages", Long: advTestCmdlongHelp, Run: func(cmd *cobra.Command, args []string) { initfiles.LoadTalEnv(false) diff --git a/clustertool/cmd/apply.go b/clustertool/cmd/apply.go index 936eecc57f88..26e36669a743 100644 --- a/clustertool/cmd/apply.go +++ b/clustertool/cmd/apply.go @@ -16,9 +16,10 @@ var applyLongHelp = strings.TrimSpace(` `) var apply = &cobra.Command{ - Use: "apply", - Short: "apply TalosConfig", - Long: applyLongHelp, + Use: "apply", + Short: "apply TalosConfig", + Example: "clustertool apply ", + Long: applyLongHelp, Run: func(cmd *cobra.Command, args []string) { var extraArgs []string node := "" diff --git a/clustertool/cmd/charts.go b/clustertool/cmd/charts.go index 4175c6e10751..11573575ceea 100644 --- a/clustertool/cmd/charts.go +++ b/clustertool/cmd/charts.go @@ -7,12 +7,10 @@ import ( ) var chartsLongHelp = strings.TrimSpace(` -charttool is a tool to help you build TrueCharts Charts +charttool was a tool to help you build TrueCharts Charts. +It has since been merged into Clustertool as "clustertool charts" -Workflow: - Create talconfig.yaml file defining your nodes information like so: - - Available commands + Example commands > charttool bump 1.2.3 patch > charttool tagclean soemtag@somedigest @@ -21,6 +19,7 @@ Workflow: var charts = &cobra.Command{ Use: "charts", Short: "A tool to help with creating Talos cluster", + Example: "charttool bump 1.2.3 patch", Long: chartsLongHelp, SilenceUsage: true, SilenceErrors: true, diff --git a/clustertool/cmd/charts_bump.go b/clustertool/cmd/charts_bump.go index 347f377a0db2..f3310b979183 100644 --- a/clustertool/cmd/charts_bump.go +++ b/clustertool/cmd/charts_bump.go @@ -16,7 +16,7 @@ var bumper = &cobra.Command{ Use: "bump", Short: "generate a bumped image version", Long: chartsBumpLongHelp, - Example: "charttool bump ", + Example: "clustertool charts bump ", Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { if err := version.Bump(args[0], args[1]); err != nil { diff --git a/clustertool/cmd/charts_deps.go b/clustertool/cmd/charts_deps.go index 892d9648631c..ac0df3be5a0c 100644 --- a/clustertool/cmd/charts_deps.go +++ b/clustertool/cmd/charts_deps.go @@ -17,7 +17,7 @@ var depsCmd = &cobra.Command{ Use: "deps", Short: "Download, Update and Verify Helm dependencies", Long: chartsDepsLongHelp, - Example: "charttool deps ", + Example: "clustertool charts deps ", Run: func(cmd *cobra.Command, args []string) { if err := deps.LoadGPGKey(); err != nil { log.Fatal().Err(err).Msg("failed to load gpg key") diff --git a/clustertool/cmd/charts_genchangelog.go b/clustertool/cmd/charts_genchangelog.go index 51188db80796..d76badce4f18 100644 --- a/clustertool/cmd/charts_genchangelog.go +++ b/clustertool/cmd/charts_genchangelog.go @@ -17,7 +17,7 @@ var genChangelogCmd = &cobra.Command{ Use: "genchangelog", Short: "Generate changelog for charts", Long: chartsGenChangelogLongHelp, - Example: "charttool genchangelog