@@ -8,73 +8,94 @@ help() {
88 echo ' commands:'
99 echo
1010
11- # Define column widths
12- local cmd_width=28
13- local opt_width=15
14- local desc_width=50
15- local column=" | %-${cmd_width} s | %-${opt_width} s | %-${desc_width} s |\n"
16- # Print table header
17- printf " $column " ' Command' ' Option' ' Description'
18- echo " |$( printf ' %*s' $(( cmd_width + 2 )) ' ' | tr ' ' ' -' ) |$( printf ' %*s' $(( opt_width + 2 )) ' ' | tr ' ' ' -' ) |$( printf ' %*s' $(( desc_width + 2 )) ' ' | tr ' ' ' -' ) |"
11+ local -a rows
12+ local max_cmd=7 max_opt=6 max_desc=11
1913
14+ rows+=(" Command|Option|Description" )
15+
2016 # Env
21- printf " $column " ' version' ' ' ' Show version of required tools.'
22- printf " $column " ' info' ' ' ' Show info about env.'
23- printf " $column " ' template-dotenv' ' ' ' Generate .env from .env.template.'
24- printf " $column " ' export-kubeconfig' ' [user][path]' ' Export kubeconfig file for service account.'
25- printf " $column " ' generate-kubconfig' ' [name]' ' Generate kubeconfig for deploymentUpdater.'
26- printf " $column " ' load-kubeconfig-from-keepass' ' [ctx]' ' Load kubeconfig file from KeePass.'
27- printf " $column " ' save-kubeconfig-to-keepass' ' [ctx]' ' Save kubeconfig file in KeePass.'
17+ rows+=( " version|| Show version of required tools." )
18+ rows+=( " info|| Show info about env." )
19+ rows+=( " template-dotenv|| Generate .env from .env.template." )
20+ rows+=( " export-kubeconfig| [user][path]| Export kubeconfig file for service account." )
21+ rows+=( " generate-kubconfig| [name]| Generate kubeconfig for deploymentUpdater." )
22+ rows+=( " load-kubeconfig-from-keepass| [ctx]| Load kubeconfig file from KeePass." )
23+ rows+=( " save-kubeconfig-to-keepass| [ctx]| Save kubeconfig file in KeePass." )
2824 # Docs
29- printf " $column " ' install-vitepress' ' ' ' Install Node dependencies.'
30- printf " $column " ' docs' ' ' ' Generate Helm chart readmes.'
31- printf " $column " ' lint' ' ' ' Lint Helm charts.'
32- printf " $column " ' dev-vitepress' ' ' ' Start VitePress dev server.'
33- printf " $column " ' build-vitepress' ' ' ' Build site with VitePress.'
34- printf " $column " ' serve-vitepress' ' ' ' Serve VitePress build.'
25+ rows+=( " install-vitepress|| Install Node dependencies." )
26+ rows+=( " docs|| Generate Helm chart readmes." )
27+ rows+=( " lint|| Lint Helm charts." )
28+ rows+=( " dev-vitepress|| Start VitePress dev server." )
29+ rows+=( " build-vitepress|| Build site with VitePress." )
30+ rows+=( " serve-vitepress|| Serve VitePress build." )
3531 # Host
36- printf " $column " ' start' ' ' ' Start kind Kubernetes cluster.'
37- printf " $column " ' start-and-prepare' ' ' ' Start and prepare Kubernetes cluster.'
38- printf " $column " ' load-image' ' [tag]' ' Load Docker image into kind cluster.'
39- printf " $column " ' delete-kind' ' ' ' Delete kind Kubernetes cluster.'
40- printf " $column " ' setup-hosts' ' ' ' Update hosts file.'
41- printf " $column " ' forward' ' [chart]' ' Forward port.'
32+ rows+=( " start|| Start kind Kubernetes cluster." )
33+ rows+=( " start-and-prepare|| Start and prepare Kubernetes cluster." )
34+ rows+=( " load-image| [tag]| Load Docker image into kind cluster." )
35+ rows+=( " delete-kind|| Delete kind Kubernetes cluster." )
36+ rows+=( " setup-hosts|| Update hosts file." )
37+ rows+=( " forward| [chart]| Forward port." )
4238 # Chart
43- printf " $column " ' list-charts' ' ' ' List local Helm charts.'
44- printf " $column " ' list-external-charts' ' ' ' List external Helm charts.'
45- printf " $column " ' list-cluster' ' ' ' List clusters.'
46- printf " $column " ' list-context' ' ' ' List kubeconfig files.'
47- printf " $column " ' switch-context' ' ' ' Switch kubeconfig file.'
48- printf " $column " ' show-context' ' ' ' Show active kubeconfig.'
49- printf " $column " ' show-cluster' ' ' ' Show active cluster.'
50- printf " $column " ' get-context-alias' ' ' ' Get alias of current context.'
51- printf " $column " ' update-dependencies' ' [chart]' ' Update dependencies for a chart.'
52- printf " $column " ' install-chart' ' [chart][values]' ' Install Helm chart.'
53- printf " $column " ' upgrade-release' ' [chart][values]' ' Upgrade Helm release.'
54- printf " $column " ' uninstall-release' ' [release]' ' Uninstall Helm release.'
39+ rows+=( " list-charts|| List local Helm charts." )
40+ rows+=( " list-external-charts|| List external Helm charts." )
41+ rows+=( " list-cluster|| List clusters." )
42+ rows+=( " list-context|| List kubeconfig files." )
43+ rows+=( " switch-context|| Switch kubeconfig file." )
44+ rows+=( " show-context|| Show active kubeconfig." )
45+ rows+=( " show-cluster|| Show active cluster." )
46+ rows+=( " get-context-alias|| Get alias of current context." )
47+ rows+=( " update-dependencies| [chart]| Update dependencies for a chart." )
48+ rows+=( " install-chart| [chart][values]| Install Helm chart." )
49+ rows+=( " upgrade-release| [chart][values]| Upgrade Helm release." )
50+ rows+=( " uninstall-release| [release]| Uninstall Helm release." )
5551 # kubectl
56- printf " $column " ' get-secrets' ' [chart]' ' Show secrets for chart.'
57- printf " $column " ' exec-bash' ' [chart]' ' Open bash shell in container.'
58- printf " $column " ' logs' ' [grep]' ' Select pods with grep and show logs.'
59- printf " $column " ' list' ' ' ' List Helm deployments.'
60- printf " $column " ' get-pods' ' ' ' List all pods.'
61- printf " $column " ' login-oc' ' ' ' Refresh the auth token for OpenShift.'
62- printf " $column " ' suspend-job' ' [name]' ' Suspend a job to stop it.'
63- printf " $column " ' unsuspend-job' ' [name]' ' Unsuspend a job to run it.'
52+ rows+=( " get-secrets| [chart]| Show secrets for chart." )
53+ rows+=( " exec-bash| [chart]| Open bash shell in container." )
54+ rows+=( " logs| [grep]| Select pods with grep and show logs." )
55+ rows+=( " list|| List Helm deployments." )
56+ rows+=( " get-pods|| List all pods." )
57+ rows+=( " login-oc|| Refresh the auth token for OpenShift." )
58+ rows+=( " suspend-job| [name]| Suspend a job to stop it." )
59+ rows+=( " unsuspend-job| [name]| Unsuspend a job to run it." )
6460 # Helm
65- printf " $column " ' add-repos' ' ' ' Add the required Helm repos.'
66- printf " $column " ' template-manifest' ' [chart][values]' ' Template all charts with Helm.'
67- printf " $column " ' package-repo' ' [chart]' ' Package Helm charts.'
68- printf " $column " ' index-repo' ' ' ' Index Helm chart.'
69- printf " $column " ' remove-repo' ' ' ' Remove the kubernetes-build repo.'
70- printf " $column " ' commit' ' ' ' Commit .tgz files.'
61+ rows+=( " add-repos|| Add the required Helm repos." )
62+ rows+=( " template-manifest| [chart][values]| Template all charts with Helm." )
63+ rows+=( " package-repo| [chart]| Package Helm charts." )
64+ rows+=( " index-repo|| Index Helm chart." )
65+ rows+=( " remove-repo|| Remove the kubernetes-build repo." )
66+ rows+=( " commit|| Commit .tgz files." )
7167 # LLM
72- printf " $column " ' commit-with-llm' ' ' ' Commit with llm generated commit message.'
73- printf " $column " ' update-with-llm' ' [glob][prompt]' ' Feed files matching glob to LLM and apply changes.'
68+ rows+=( " commit-with-llm|| Commit with llm generated commit message." )
69+ rows+=( " update-with-llm| [glob][prompt]| Feed files matching glob to LLM and apply changes." )
7470 # Test
75- printf " $column " ' test-chart-clusterIssuer' ' ' ' Test cluster issuer.'
76- printf " $column " ' test-chart-odoo' ' [cleanup]' ' Setup Odoo chart and dependencies.'
77- printf " $column " ' test-chart-nextcloud' ' [cleanup]' ' Setup Nextcloud chart and dependencies.'
71+ rows+=(" test-chart-clusterIssuer||Test cluster issuer." )
72+ rows+=(" test-chart-odoo|[cleanup]|Setup Odoo chart and dependencies." )
73+ rows+=(" test-chart-nextcloud|[cleanup]|Setup Nextcloud chart and dependencies." )
74+
75+ for row in " ${rows[@]} " ; do
76+ IFS=' |' read -r cmd opt desc <<< " $row"
77+ (( ${# cmd} > max_cmd )) && max_cmd=${# cmd}
78+ (( ${# opt} > max_opt )) && max_opt=${# opt}
79+ (( ${# desc} > max_desc )) && max_desc=${# desc}
80+ done
81+
82+ printf ' | %-*s | %-*s | %-*s |\n' \
83+ " $max_cmd " " Command" \
84+ " $max_opt " " Option" \
85+ " $max_desc " " Description"
86+
87+ printf ' |-%*s-|-%*s-|-%*s-|\n' \
88+ " $max_cmd " " $( printf ' %*s' " $max_cmd " ' ' | tr ' ' ' -' ) " \
89+ " $max_opt " " $( printf ' %*s' " $max_opt " ' ' | tr ' ' ' -' ) " \
90+ " $max_desc " " $( printf ' %*s' " $max_desc " ' ' | tr ' ' ' -' ) "
91+
92+ for row in " ${rows[@]: 1} " ; do
93+ IFS=' |' read -r cmd opt desc <<< " $row"
94+ printf ' | %-*s | %-*s | %-*s |\n' \
95+ " $max_cmd " " $cmd " \
96+ " $max_opt " " $opt " \
97+ " $max_desc " " $desc "
98+ done
7899}
79100
80101# Default vars
0 commit comments