From c36e0165f4d2ca6d7afa9025eff8d651ea0d3db1 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Wed, 16 Apr 2025 07:27:37 +0200 Subject: [PATCH 1/4] Help make json with header section ##@ General will make below help a subsection --- snippets/make.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/make.json b/snippets/make.json index 57277ee2..888e272f 100644 --- a/snippets/make.json +++ b/snippets/make.json @@ -3,7 +3,7 @@ "prefix": "help", "body": [ "help: ## Prints help for targets with comments", - "\t@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = \":.*?## \"}; {printf \"\\033[36m%-30s\\033[0m %s\\n\", $\\$1, $\\$2}'" + "\tawk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $$1, $$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($$0, 5) } ' $(MAKEFILE_LIST)" ], "description": "help target for self-documented Makefile" }, From e25d62f40fcbebad51f0930dc7c37630ed180e86 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Wed, 16 Apr 2025 07:35:42 +0200 Subject: [PATCH 2/4] fix escape --- snippets/make.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/make.json b/snippets/make.json index 888e272f..ea63189a 100644 --- a/snippets/make.json +++ b/snippets/make.json @@ -3,7 +3,7 @@ "prefix": "help", "body": [ "help: ## Prints help for targets with comments", - "\tawk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $$1, $$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($$0, 5) } ' $(MAKEFILE_LIST)" + "\tawk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $\\$1, $\\$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($\\$0, 5) } ' $(MAKEFILE_LIST)" ], "description": "help target for self-documented Makefile" }, From aafc32ed865c25e2e648122e345df94c63441809 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Wed, 16 Apr 2025 07:36:58 +0200 Subject: [PATCH 3/4] Suppress command --- snippets/make.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/make.json b/snippets/make.json index ea63189a..8d4c6d80 100644 --- a/snippets/make.json +++ b/snippets/make.json @@ -3,7 +3,7 @@ "prefix": "help", "body": [ "help: ## Prints help for targets with comments", - "\tawk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $\\$1, $\\$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($\\$0, 5) } ' $(MAKEFILE_LIST)" + "\t@awk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $\\$1, $\\$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($\\$0, 5) } ' $(MAKEFILE_LIST)" ], "description": "help target for self-documented Makefile" }, From 390999e4707e31c5deed4a9009ee22019e3b1415 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Wed, 16 Apr 2025 07:46:40 +0200 Subject: [PATCH 4/4] Add bit more gap for long command help messages --- snippets/make.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/make.json b/snippets/make.json index 8d4c6d80..976ae6c5 100644 --- a/snippets/make.json +++ b/snippets/make.json @@ -3,7 +3,7 @@ "prefix": "help", "body": [ "help: ## Prints help for targets with comments", - "\t@awk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-15s\\033[0m %s\\n\", $\\$1, $\\$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($\\$0, 5) } ' $(MAKEFILE_LIST)" + "\t@awk 'BEGIN {FS = \":.*##\"; printf \"\\nUsage:\\n make \\033[36m\\033[0m\\n\"} /^[a-zA-Z_0-9-]+:.*?##/ { printf \" \\033[36m%-25s\\033[0m %s\\n\", $\\$1, $\\$2 } /^##@/ { printf \"\\n\\033[1m%s\\033[0m\\n\", substr($\\$0, 5) } ' $(MAKEFILE_LIST)" ], "description": "help target for self-documented Makefile" },