diff --git a/Makefile b/Makefile index 7eee8f4117..11318ead41 100644 --- a/Makefile +++ b/Makefile @@ -160,3 +160,8 @@ release.prod: test .PHONY: ko ko: scripts/install-ko.sh + +# generate-documentation: Generate documentation (docs/flags.md) +.PHONE: generate-docs +generate-documentation: + go run internal/gen/main.go diff --git a/docs/flags.md b/docs/flags.md index b525af280d..22046b2ea3 100644 --- a/docs/flags.md +++ b/docs/flags.md @@ -1,7 +1,7 @@ # Flags - + | Flag | Description | | :------ | :----------- | diff --git a/internal/gen/main.go b/internal/gen/main.go index 4ac47e6983..8c0ca8e247 100644 --- a/internal/gen/main.go +++ b/internal/gen/main.go @@ -40,7 +40,7 @@ func (f *Flags) AddFlag(name, description string) { const markdownTemplate = `# Flags - + | Flag | Description | | :------ | :----------- | diff --git a/internal/gen/main_test.go b/internal/gen/main_test.go index b751982906..7f6abab8c3 100644 --- a/internal/gen/main_test.go +++ b/internal/gen/main_test.go @@ -71,7 +71,7 @@ func TestFlagsMdUpToDate(t *testing.T) { actual, err := flags.generateMarkdownTable() assert.NoError(t, err) - assert.True(t, len(expected) == len(actual), "expected file '%s' to be up to date. execute 'go run internal/gen/main.g", filePath) + assert.True(t, len(expected) == len(actual), "expected file '%s' to be up to date. execute 'make generate-documentation", filePath) } func TestFlagsMdExtraFlagAdded(t *testing.T) {