diff --git a/Makefile b/Makefile
index b5c78f2c685e85a550f272db40a67d81b0e8d261..af88aeb35229c5ca5e7f5653c01d9516c5add335 100644
--- a/Makefile
+++ b/Makefile
@@ -19,3 +19,6 @@ build:
 
 install:
 	go install cmd/tk
+
+docs:
+	mkdir -p ./docs/cmd && go run ./cmd/tk/ docgen
diff --git a/cmd/tk/main.go b/cmd/tk/main.go
index 33aa2178d9e89f6db32d97a4517b5db9e297540a..b6b5797fc2ff32d372db7b67865301fc94c1ec96 100644
--- a/cmd/tk/main.go
+++ b/cmd/tk/main.go
@@ -9,6 +9,7 @@ import (
 	"time"
 
 	"github.com/spf13/cobra"
+	"github.com/spf13/cobra/doc"
 	"k8s.io/client-go/kubernetes"
 	_ "k8s.io/client-go/plugin/pkg/client/auth"
 	"k8s.io/client-go/tools/clientcmd"
@@ -18,7 +19,8 @@ var VERSION = "0.0.1"
 
 var rootCmd = &cobra.Command{
 	Use:           "tk",
-	Short:         "Kubernetes CD assembler",
+	Short:         "Command line utility for assembling Kubernetes CD pipelines",
+	Long:          `Command line utility for assembling Kubernetes CD pipelines.`,
 	Version:       VERSION,
 	SilenceUsage:  true,
 	SilenceErrors: true,
@@ -31,13 +33,6 @@ var (
 )
 
 func init() {
-	if home := homeDir(); home != "" {
-		rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", filepath.Join(home, ".kube", "config"),
-			"path to the kubeconfig file")
-	} else {
-		rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", "",
-			"absolute path to the kubeconfig file")
-	}
 	rootCmd.PersistentFlags().StringVarP(&namespace, "namespace", "", "gitops-system",
 		"the namespace scope for this operation")
 	rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "", 5*time.Minute,
@@ -46,6 +41,8 @@ func init() {
 
 func main() {
 	log.SetFlags(0)
+	generateDocs()
+	kubeconfigFlag()
 	if err := rootCmd.Execute(); err != nil {
 		logFailure("%v", err)
 		os.Exit(1)
@@ -93,3 +90,26 @@ func logSuccess(format string, a ...interface{}) {
 func logFailure(format string, a ...interface{}) {
 	fmt.Println(`✗`, fmt.Sprintf(format, a...))
 }
+
+func generateDocs() {
+	args := os.Args[1:]
+	if len(args) > 0 && args[0] == "docgen" {
+		rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", "~/.kube/config",
+			"path to the kubeconfig file")
+		err := doc.GenMarkdownTree(rootCmd, "./docs/cmd")
+		if err != nil {
+			log.Fatal(err)
+		}
+		os.Exit(0)
+	}
+}
+
+func kubeconfigFlag() {
+	if home := homeDir(); home != "" {
+		rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", filepath.Join(home, ".kube", "config"),
+			"path to the kubeconfig file")
+	} else {
+		rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", "",
+			"absolute path to the kubeconfig file")
+	}
+}
diff --git a/go.sum b/go.sum
index 221b5a3ed5098221f929e492f9a49b9ba8aa847c..eb16da427d43e0a974e51d6f70b6f39638b5da87 100644
--- a/go.sum
+++ b/go.sum
@@ -41,6 +41,7 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc
 github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -171,7 +172,9 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
 github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=