diff --git a/Makefile b/Makefile index 0e85f8ee3c1d65f34107f9789e220399cdb2c235..d99ccfcb3373cc4efef9913e9f1c703a9f930a51 100644 --- a/Makefile +++ b/Makefile @@ -23,3 +23,6 @@ install: .PHONY: docs docs: mkdir -p ./docs/cmd && go run ./cmd/tk/ docgen + +install-dev: + CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/tk diff --git a/cmd/tk/completion.go b/cmd/tk/completion.go new file mode 100644 index 0000000000000000000000000000000000000000..be44ed2fae2b4aec5d595fba46e20b02c0970981 --- /dev/null +++ b/cmd/tk/completion.go @@ -0,0 +1,28 @@ +package main + +import ( + "os" + + "github.com/spf13/cobra" +) + +var completionCmd = &cobra.Command{ + Use: "completion", + Short: "Generates bash completion scripts", + Example: `To load completion run + +. <(tk completion) + +To configure your bash shell to load completions for each session add to your bashrc + +# ~/.bashrc or ~/.profile +. <(tk completion) +`, + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenBashCompletion(os.Stdout) + }, +} + +func init() { + rootCmd.AddCommand(completionCmd) +} diff --git a/cmd/tk/delete_kustomization.go b/cmd/tk/delete_kustomization.go index 684c7e746efad7e494b1027686c313033a616c69..2968ad0bfba33676c206552730cbed52772cc8ea 100644 --- a/cmd/tk/delete_kustomization.go +++ b/cmd/tk/delete_kustomization.go @@ -47,15 +47,11 @@ func deleteKsCmdRun(cmd *cobra.Command, args []string) error { } if !deleteSilent { - warning := "This action will remove the Kubernetes objects previously applied by this kustomization. " - if kustomization.Spec.Suspend { - warning = "" + if !kustomization.Spec.Suspend { + logWaiting("This action will remove the Kubernetes objects previously applied by the %s kustomization!", name) } prompt := promptui.Prompt{ - Label: fmt.Sprintf( - "%sAre you sure you want to delete the %s kustomization from the %s namespace", - warning, name, namespace, - ), + Label: "Are you sure you want to delete this kustomization", IsConfirm: true, } if _, err := prompt.Run(); err != nil { diff --git a/cmd/tk/delete_source_git.go b/cmd/tk/delete_source_git.go index 9ff9bb39ca081e962fcbc50a27a5bbf8e2b77dbd..467955137b31bf7afccc4f9abe8def25115aed51 100644 --- a/cmd/tk/delete_source_git.go +++ b/cmd/tk/delete_source_git.go @@ -47,9 +47,7 @@ func deleteSourceGitCmdRun(cmd *cobra.Command, args []string) error { if !deleteSilent { prompt := promptui.Prompt{ - Label: fmt.Sprintf( - "Are you sure you want to delete the %s source from the %s namespace", name, namespace, - ), + Label: "Are you sure you want to delete this source", IsConfirm: true, } if _, err := prompt.Run(); err != nil { diff --git a/docs/cmd/tk.md b/docs/cmd/tk.md index 160a76415fb127efeb71cbb1227d9956f698104e..d301a1e96b9800c6bf7a6376f1c0b743d13f96cb 100644 --- a/docs/cmd/tk.md +++ b/docs/cmd/tk.md @@ -79,6 +79,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way. ### SEE ALSO * [tk check](tk_check.md) - Check requirements and installation +* [tk completion](tk_completion.md) - Generates bash completion scripts * [tk create](tk_create.md) - Create commands * [tk delete](tk_delete.md) - Delete commands * [tk export](tk_export.md) - Export commands @@ -89,4 +90,4 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way. * [tk sync](tk_sync.md) - Synchronize commands * [tk uninstall](tk_uninstall.md) - Uninstall the toolkit components -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_check.md b/docs/cmd/tk_check.md index 4a3b006e2038602be4fceeb772f9c03d2dd6eba0..54a7a0c130121bac1b7338aea00deae929d92d27 100644 --- a/docs/cmd/tk_check.md +++ b/docs/cmd/tk_check.md @@ -44,4 +44,4 @@ tk check [flags] * [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_completion.md b/docs/cmd/tk_completion.md new file mode 100644 index 0000000000000000000000000000000000000000..db509b83a84529cce3cf68973058366f1a1478c8 --- /dev/null +++ b/docs/cmd/tk_completion.md @@ -0,0 +1,47 @@ +## tk completion + +Generates bash completion scripts + +### Synopsis + +Generates bash completion scripts + +``` +tk completion [flags] +``` + +### Examples + +``` +To load completion run + +. <(tk completion) + +To configure your bash shell to load completions for each session add to your bashrc + +# ~/.bashrc or ~/.profile +. <(tk completion) + +``` + +### Options + +``` + -h, --help help for completion +``` + +### Options inherited from parent commands + +``` + --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller]) + --kubeconfig string path to the kubeconfig file (default "~/.kube/config") + --namespace string the namespace scope for this operation (default "gitops-system") + --timeout duration timeout for this operation (default 5m0s) + --verbose print generated objects +``` + +### SEE ALSO + +* [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines + +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_create.md b/docs/cmd/tk_create.md index 8802511ba60628bb609a16a1b8df23ec26b6b27f..2dc7a8d9cb5e9ff008b1652fc66c055cdb38b210 100644 --- a/docs/cmd/tk_create.md +++ b/docs/cmd/tk_create.md @@ -29,4 +29,4 @@ Create commands * [tk create kustomization](tk_create_kustomization.md) - Create or update a kustomization resource * [tk create source](tk_create_source.md) - Create source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_create_kustomization.md b/docs/cmd/tk_create_kustomization.md index 3c17838ddb49057cdcccbeed3e7932aade74c6a3..2d8beb0039c39a6ebb57ce80c7af410b28f47b63 100644 --- a/docs/cmd/tk_create_kustomization.md +++ b/docs/cmd/tk_create_kustomization.md @@ -67,4 +67,4 @@ tk create kustomization [name] [flags] * [tk create](tk_create.md) - Create commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_create_source.md b/docs/cmd/tk_create_source.md index df355e6686dc5a16fc633a6808a52172a070e6bd..a6bdf6a186ed406aa512bf452897fc0362ab0da7 100644 --- a/docs/cmd/tk_create_source.md +++ b/docs/cmd/tk_create_source.md @@ -28,4 +28,4 @@ Create source commands * [tk create](tk_create.md) - Create commands * [tk create source git](tk_create_source_git.md) - Create or update a git source -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_create_source_git.md b/docs/cmd/tk_create_source_git.md index bb9484b623b3338500b4785edfe61848ce1893e4..8f13fc7c133463640314168c0b4a80b7030c0351 100644 --- a/docs/cmd/tk_create_source_git.md +++ b/docs/cmd/tk_create_source_git.md @@ -71,4 +71,4 @@ tk create source git [name] [flags] * [tk create source](tk_create_source.md) - Create source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_delete.md b/docs/cmd/tk_delete.md index 3e1ee2c92483baf7b5eb56a042919418a23826d3..42ff8e30739e6593dca6fd333e0a3299c6ccf77c 100644 --- a/docs/cmd/tk_delete.md +++ b/docs/cmd/tk_delete.md @@ -10,7 +10,7 @@ Delete commands ``` -h, --help help for delete - --silent delete resource without asking for confirmation + -s, --silent delete resource without asking for confirmation ``` ### Options inherited from parent commands @@ -29,4 +29,4 @@ Delete commands * [tk delete kustomization](tk_delete_kustomization.md) - Delete kustomization * [tk delete source](tk_delete_source.md) - Delete sources commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_delete_kustomization.md b/docs/cmd/tk_delete_kustomization.md index dd115e8dd9a47367667dc04642f058d05e305504..5a7bbb1f4856c50e7d6a6377fbe2fd89c2d9360c 100644 --- a/docs/cmd/tk_delete_kustomization.md +++ b/docs/cmd/tk_delete_kustomization.md @@ -22,7 +22,7 @@ tk delete kustomization [name] [flags] --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller]) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") --namespace string the namespace scope for this operation (default "gitops-system") - --silent delete resource without asking for confirmation + -s, --silent delete resource without asking for confirmation --timeout duration timeout for this operation (default 5m0s) --verbose print generated objects ``` @@ -31,4 +31,4 @@ tk delete kustomization [name] [flags] * [tk delete](tk_delete.md) - Delete commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_delete_source.md b/docs/cmd/tk_delete_source.md index 073f5f09ab538cde3fdc3c098f2be985b2e5e4b4..a1834b17622f4b304028d5545cab8fa7391f0d7a 100644 --- a/docs/cmd/tk_delete_source.md +++ b/docs/cmd/tk_delete_source.md @@ -18,7 +18,7 @@ Delete sources commands --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller]) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") --namespace string the namespace scope for this operation (default "gitops-system") - --silent delete resource without asking for confirmation + -s, --silent delete resource without asking for confirmation --timeout duration timeout for this operation (default 5m0s) --verbose print generated objects ``` @@ -28,4 +28,4 @@ Delete sources commands * [tk delete](tk_delete.md) - Delete commands * [tk delete source git](tk_delete_source_git.md) - Delete git source -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_delete_source_git.md b/docs/cmd/tk_delete_source_git.md index f024b3dac54821f2edb911a6af849a5cfa3bc6c3..9194ffe902b7afa9d7754630d92d828db6b48012 100644 --- a/docs/cmd/tk_delete_source_git.md +++ b/docs/cmd/tk_delete_source_git.md @@ -22,7 +22,7 @@ tk delete source git [name] [flags] --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller]) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") --namespace string the namespace scope for this operation (default "gitops-system") - --silent delete resource without asking for confirmation + -s, --silent delete resource without asking for confirmation --timeout duration timeout for this operation (default 5m0s) --verbose print generated objects ``` @@ -31,4 +31,4 @@ tk delete source git [name] [flags] * [tk delete source](tk_delete_source.md) - Delete sources commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_export.md b/docs/cmd/tk_export.md index a47d31b4f6063c8a1460d6e5ee86756028f231a8..e7c0f012109ba7dd9d7d5a8f3e285181affc0e2c 100644 --- a/docs/cmd/tk_export.md +++ b/docs/cmd/tk_export.md @@ -29,4 +29,4 @@ Export commands * [tk export kustomization](tk_export_kustomization.md) - Export kustomization in YAML format * [tk export source](tk_export_source.md) - Export source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_export_kustomization.md b/docs/cmd/tk_export_kustomization.md index 5f7d807d14a57be873aa7a8bc2c2078396e3d34e..74d30d83e1088af4bce6d1faa2396a1431fdc3dc 100644 --- a/docs/cmd/tk_export_kustomization.md +++ b/docs/cmd/tk_export_kustomization.md @@ -42,4 +42,4 @@ tk export kustomization [name] [flags] * [tk export](tk_export.md) - Export commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_export_source.md b/docs/cmd/tk_export_source.md index 40582eb3d66c0cfd1619f330bc21b91d58f6fbf6..228dc581ca193ae396fab891d236b6a049ca20ff 100644 --- a/docs/cmd/tk_export_source.md +++ b/docs/cmd/tk_export_source.md @@ -29,4 +29,4 @@ Export source commands * [tk export](tk_export.md) - Export commands * [tk export source git](tk_export_source_git.md) - Export git sources in YAML format -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_export_source_git.md b/docs/cmd/tk_export_source_git.md index daee64888eeae9a9e0588ae3beddb4c9d19e0e27..f64c4d4cb8c0c07be3ec6a67ecb26215b98e0e1f 100644 --- a/docs/cmd/tk_export_source_git.md +++ b/docs/cmd/tk_export_source_git.md @@ -43,4 +43,4 @@ tk export source git [name] [flags] * [tk export source](tk_export_source.md) - Export source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_get.md b/docs/cmd/tk_get.md index d2a81f40a66f26ed9ba5ac904472df196d88eac8..51d293dff10e3e490b2d0d2c5ba17f73447616e4 100644 --- a/docs/cmd/tk_get.md +++ b/docs/cmd/tk_get.md @@ -28,4 +28,4 @@ Get commands * [tk get kustomizations](tk_get_kustomizations.md) - Get kustomizations status * [tk get sources](tk_get_sources.md) - Get sources commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_get_kustomizations.md b/docs/cmd/tk_get_kustomizations.md index d636c2acba00a76d2e6ea4dbf10f4da66de5b6de..3f454e74ad8ec82672e24622c69b4461df49312f 100644 --- a/docs/cmd/tk_get_kustomizations.md +++ b/docs/cmd/tk_get_kustomizations.md @@ -31,4 +31,4 @@ tk get kustomizations [flags] * [tk get](tk_get.md) - Get commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_get_sources.md b/docs/cmd/tk_get_sources.md index c964eed8e8011afb3017b716a866dc322beaeb3b..911674b841b1fee821cdd174e0afc576d6ff51c1 100644 --- a/docs/cmd/tk_get_sources.md +++ b/docs/cmd/tk_get_sources.md @@ -27,4 +27,4 @@ Get sources commands * [tk get](tk_get.md) - Get commands * [tk get sources git](tk_get_sources_git.md) - Get git sources status -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_get_sources_git.md b/docs/cmd/tk_get_sources_git.md index 654c5b0bc9558f6bf701f1febf24220473cfe0a7..5691ade5cbe571b61d20449c01bc2aa02559070d 100644 --- a/docs/cmd/tk_get_sources_git.md +++ b/docs/cmd/tk_get_sources_git.md @@ -31,4 +31,4 @@ tk get sources git [flags] * [tk get sources](tk_get_sources.md) - Get sources commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_install.md b/docs/cmd/tk_install.md index 285012caaa8508a9a9864e08f9b3367641bf7d62..53dc3bf63a2bea79808cd6ca55a0e476a595ef7c 100644 --- a/docs/cmd/tk_install.md +++ b/docs/cmd/tk_install.md @@ -49,4 +49,4 @@ tk install [flags] * [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_resume.md b/docs/cmd/tk_resume.md index acca85e9d1a84ed033d3514ac00d07df3013b325..75192317d848f06c23b0f72cc0ed3280ca7af57c 100644 --- a/docs/cmd/tk_resume.md +++ b/docs/cmd/tk_resume.md @@ -27,4 +27,4 @@ Resume commands * [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines * [tk resume kustomization](tk_resume_kustomization.md) - Resume kustomization -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_resume_kustomization.md b/docs/cmd/tk_resume_kustomization.md index b8791852f0dbdf3e2aac210bee59383b58b85410..1d3430ef72b82c73178516de306220931e7827aa 100644 --- a/docs/cmd/tk_resume_kustomization.md +++ b/docs/cmd/tk_resume_kustomization.md @@ -30,4 +30,4 @@ tk resume kustomization [name] [flags] * [tk resume](tk_resume.md) - Resume commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_suspend.md b/docs/cmd/tk_suspend.md index 45ca28bb7ad95a0feec512342713ce7a55d54d98..823af3d8a088d48b2141a2582b98cb8254469ee6 100644 --- a/docs/cmd/tk_suspend.md +++ b/docs/cmd/tk_suspend.md @@ -27,4 +27,4 @@ Suspend commands * [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines * [tk suspend kustomization](tk_suspend_kustomization.md) - Suspend kustomization -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_suspend_kustomization.md b/docs/cmd/tk_suspend_kustomization.md index c22709bbfeda347e1b1feac5cab5e2759bcf804f..2e108dc0bf835a2f9cbb35e38505f8a259fb1324 100644 --- a/docs/cmd/tk_suspend_kustomization.md +++ b/docs/cmd/tk_suspend_kustomization.md @@ -30,4 +30,4 @@ tk suspend kustomization [name] [flags] * [tk suspend](tk_suspend.md) - Suspend commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_sync.md b/docs/cmd/tk_sync.md index 7a5fa75d1b799d91f3efb16875ec461348deb045..5167d91a9140d8cb53278426fa8db05e9c87a46e 100644 --- a/docs/cmd/tk_sync.md +++ b/docs/cmd/tk_sync.md @@ -28,4 +28,4 @@ Synchronize commands * [tk sync kustomization](tk_sync_kustomization.md) - Synchronize kustomization * [tk sync source](tk_sync_source.md) - Synchronize source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_sync_kustomization.md b/docs/cmd/tk_sync_kustomization.md index 1c188a2f9569239179e1278844c04117423a39c5..0d2ff3af7d12b9c9d5bf2a60579f2e1dc7e11f4e 100644 --- a/docs/cmd/tk_sync_kustomization.md +++ b/docs/cmd/tk_sync_kustomization.md @@ -43,4 +43,4 @@ tk sync kustomization [name] [flags] * [tk sync](tk_sync.md) - Synchronize commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_sync_source.md b/docs/cmd/tk_sync_source.md index af73f2d5409e502b25a2bb62cee3e94f3d0dc4ad..9b4662d502cb6c5047a0ea8293490d189bbb1b48 100644 --- a/docs/cmd/tk_sync_source.md +++ b/docs/cmd/tk_sync_source.md @@ -27,4 +27,4 @@ Synchronize source commands * [tk sync](tk_sync.md) - Synchronize commands * [tk sync source git](tk_sync_source_git.md) - Synchronize git source -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_sync_source_git.md b/docs/cmd/tk_sync_source_git.md index 38be98e050c9952153a3ca2349a7670c4560146a..71803d34388d1f7fa9711ce9336549091cb3d8f9 100644 --- a/docs/cmd/tk_sync_source_git.md +++ b/docs/cmd/tk_sync_source_git.md @@ -39,4 +39,4 @@ tk sync source git [name] [flags] * [tk sync source](tk_sync_source.md) - Synchronize source commands -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020 diff --git a/docs/cmd/tk_uninstall.md b/docs/cmd/tk_uninstall.md index 5e691b63d6108b336e76910a9caf774632376511..913e70d00050e73a06d768cce6685606a0f7067a 100644 --- a/docs/cmd/tk_uninstall.md +++ b/docs/cmd/tk_uninstall.md @@ -29,7 +29,7 @@ tk uninstall [flags] --crds removes all CRDs previously installed --dry-run only print the object that would be deleted -h, --help help for uninstall - --silent delete components without asking for confirmation + -s, --silent delete components without asking for confirmation ``` ### Options inherited from parent commands @@ -46,4 +46,4 @@ tk uninstall [flags] * [tk](tk.md) - Command line utility for assembling Kubernetes CD pipelines -###### Auto generated by spf13/cobra on 30-Apr-2020 +###### Auto generated by spf13/cobra on 1-May-2020