Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjb committed Oct 26, 2023
1 parent 9e8735f commit bdbe231
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ clean: ## Remove files generated by other targets

.PHONY: cli-docs
cli-docs: ## generate cli documenation
@echo "Generating the docs"
rm -rf docs/content/reference && mkdir docs/content/reference
cd docs/content/reference && $(GO) run -tags docs -exec 'env HOME=$$HOME' ../../../hack/generate-docs.go
@echo "Configuring the _index.md file with the appropriate header"
NL=$$'\n'; sed -e "1,/---/ { /^title:/ { \
a \\$${NL}aliases:\\$${NL}- /reference/pgo\\$${NL}weight: 100$${NL}; \
c \\$${NL}title: Command Reference$${NL}; \
}; }" \
docs/content/reference/pgo.md > \
docs/content/reference/_index.md
rm docs/content/reference/pgo.md
@echo "Break out a separate code block for `Example output`"
for filename in $(wildcard docs/content/reference/pgo_*.md); do \
NL=$$'\n'; \
sed -i "s/### Example output/\`\`\`\\$${NL}### Example output\\$${NL}\`\`\`/g" $${filename}; \
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/pgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func NewPGOCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command {
{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`)

// We take the default UsageTemplate and alter it for our needs
// -- source: https://github.com/spf13/cobra/blob/main/command.go#UsageTemplate
root.SetUsageTemplate(`Usage:{{if .Runnable}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
Expand Down

0 comments on commit bdbe231

Please sign in to comment.