Skip to content

Commit

Permalink
Tidy up make generate target
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Mar 24, 2021
1 parent 9cc8184 commit e996856
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
${{ runner.os }}-go1.16.2-
- name: Generate
run: |
make completions
make generate
git diff --exit-code
lint:
runs-on: ubuntu-18.04
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ run:
test:
$(GO) test ./...

.PHONY: generate
generate: completions assets/scripts/install.sh

.PHONY: completions
completions:
$(GO) run . completion bash -o completions/chezmoi-completion.bash
$(GO) run . completion fish -o completions/chezmoi.fish
$(GO) run . completion powershell -o completions/chezmoi.ps1
$(GO) run . completion zsh -o completions/chezmoi.zsh

.PHONY: generate-install.sh
generate-install.sh:
$(GO) run ./internal/cmd/generate-install.sh > assets/scripts/install.sh
assets/scripts/install.sh: internal/cmd/generate-install.sh/install.sh.tmpl internal/cmd/generate-install.sh/main.go
$(GO) run ./internal/cmd/generate-install.sh > $@

.PHONY: lint
lint: ensure-golangci-lint
Expand Down
12 changes: 7 additions & 5 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ Run chezmoi:

## Generated code

chezmoi generates shell completions, embedded files, and the website from a
chezmoi generates shell completions, the install script, and the website from a
single source of truth. You must run

make completions
make generate

if you change includes any of the following:

* Add or modify a command.
* Add or modify a command's flags.
* Adds or modifies a command.
* Adds or modifies a command's flags.
* Adds or modifies the list of supported OSs and architectures.
* Modifies the install script template.

chezmoi's continuous integration verifies that all generated files are up to
date. Changes to generated files should be included in the commit that modifies
Expand Down Expand Up @@ -78,7 +80,7 @@ that:
entry in `docs/HOWTO.md` and a complete description in `docs/REFERENCE.md`.

* All generated files are up to date. You can ensure this by running `make
completions` and including any modified files in your commit.
generate` and including any modified files in your commit.

* The code is correctly formatted, according to
[`gofumports`](https://mvdan.cc/gofumpt/gofumports). You can ensure this by
Expand Down

0 comments on commit e996856

Please sign in to comment.