From fc7584ca1ccf726f8d1c9822ed5fa90230da006e Mon Sep 17 00:00:00 2001 From: Rosiney Gomes Pereira Date: Wed, 26 May 2021 21:06:49 -0300 Subject: [PATCH] feat: list makefiles targets --- .mkdkr | 6 ++++++ README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/.mkdkr b/.mkdkr index ebb666d..ee4ae5f 100755 --- a/.mkdkr +++ b/.mkdkr @@ -256,6 +256,12 @@ define dkr = trap _job_destroy EXIT _pretty "orange" "\nstart: \$(@)\n" endef + +.PHONY: _list +_list: + @FILTER="^[a-zA-Z_]([a-zA-Z0-9\_\/\.\-])+?:((\ [a-zA-Z][a-zA-Z0-9\_\/\.\-]+)?)+\$\$" + make -qp 2> /dev/null | grep -E "\$\$FILTER" | grep -v -E '(Makefile|_list)' | sort -u + EOF } diff --git a/README.md b/README.md index bf65c5d..b102319 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Table of contents - [Implicit](#implicit) - [mkdkr.csv](#mkdkrcsv) - [Collection](#collection) +- [Builtin Targets](#builtin-targets) + - [_list](#_list) - [Helpers](#helpers) - [Examples](#examples) - [Simple](#simple) @@ -561,6 +563,52 @@ The file contains four values per line in following order > Small collection, use it as example +# Builtin Targets + +## _list + +List all targets in `Makefile`, include extensions. + +```shell +$ make _list + +include + +alias: exporter, repos: https://github.com/rosineygp/mkdkr_exporter.git, checkout: v1.5.0, file: main.mk + +replace: MKDKR_EXPORTER_TAG=latest to v1.5.0 +bash.v4-0: +bash.v4-1: +bash.v4-2: +bash.v4-3: +bash.v4-4: +bash.v5-0: +_coverage.report: +examples.dind: +examples.escapes: +examples.pipeline: +examples.retry: +examples.service: +examples.shell: +examples.simple: +examples.stdout: +_exporter_bitbucket-pipelines: +_exporter_circle-ci: +_exporter_github: +_exporter_gitlab-ci: +_exporter_jenkins_pipeline: +_exporter_shell: +_exporter_travis: +lint.commit: +lint.hadolint: +lint.shellcheck: +test.unit: +``` + +> The result are sorted by name. +> +> First char target name: [a-zA-Z_] + # Helpers A set of small functions to common pipelines process.