diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5a3c788de5b..32b63360fc5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -35,6 +35,8 @@ jobs: - run: git diff --exit-code - run: make docsgen-cli - run: git diff --exit-code + - run: make docsgen-config + - run: git diff --exit-code check-lint: name: Check (lint-all) runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 62a7a9b9db1..c80ed3f8da2 100644 --- a/Makefile +++ b/Makefile @@ -339,7 +339,7 @@ fiximports: gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen $(GOCC) run ./scripts/fiximports - @echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli'" + @echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli' and/or 'make docsgen-config'" .PHONY: gen jen: gen @@ -348,11 +348,15 @@ snap: lotus lotus-miner lotus-worker snapcraft # snapcraft upload ./lotus_*.snap -docsgen-cli: lotus lotus-miner lotus-worker +docsgen-cli: $(GOCC) run ./scripts/docsgen-cli +.PHONY: docsgen-cli + +# Compiled lotus and lotus-miner are required to generate the default config files +docsgen-config: lotus lotus-miner ./lotus config default > documentation/en/default-lotus-config.toml ./lotus-miner config default > documentation/en/default-lotus-miner-config.toml -.PHONY: docsgen-cli +.PHONY: docsgen-config print-%: @echo $*=$($*) diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index 4b638b57d80..08e252714e5 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -42,7 +42,7 @@ COMMANDS: GLOBAL OPTIONS: --color use color in display output (default: depends on output being a TTY) - --interactive setting to false will disable interactive functionality of commands (default: true) + --interactive setting to false will disable interactive functionality of commands (default: false) --force-send if true, will ignore pre-send checks (default: false) --vv enables very verbose mode, useful for debugging the CLI (default: false) --help, -h show help diff --git a/documentation/misc/Building_a_network_skeleton.md b/documentation/misc/Building_a_network_skeleton.md index 1fae76b923b..1c6637fcba1 100644 --- a/documentation/misc/Building_a_network_skeleton.md +++ b/documentation/misc/Building_a_network_skeleton.md @@ -248,7 +248,7 @@ Note: one only needs to update `filecion-ffi`'s dependency on `go-state-types` w 11. Run `make gen`. -12. Run `make docsgen-cli`. +12. Run `make docsgen-cli docsgen-config`. And you're done! These are all the steps necessary to create a network upgrade skeleton that you will be able to run in a local devnet, and creates a basis where you can start testing new FIPs. When running a local developer network from this Lotus branch, bringing in all it dependencies, you should be able to: diff --git a/documentation/misc/RELEASE_ISSUE_TEMPLATE.md b/documentation/misc/RELEASE_ISSUE_TEMPLATE.md index 75cb5032fa4..0507b55ea16 100644 --- a/documentation/misc/RELEASE_ISSUE_TEMPLATE.md +++ b/documentation/misc/RELEASE_ISSUE_TEMPLATE.md @@ -78,7 +78,7 @@ - Ensure to update `MinerBuildVersion` - - [ ] Run `make gen && make docsgen-cli` before committing changes. + - [ ] Run `make gen && make docsgen-cli docsgen-config` before committing changes. - [ ] Update the CHANGELOG - [ ] Change the `UNRELEASED` section header to `UNRELEASED v{{.Tag}}` - [ ] Set the `UNRELEASED v{{.Tag}}` section's content to be "_See https://github.com/filecoin-project/lotus/blob/release/v{{.Tag}}/CHANGELOG.md_" @@ -118,7 +118,7 @@ - Ensure to update `MinerBuildVersion` -- [ ] Run `make gen && make docsgen-cli` to generate documentation +- [ ] Run `make gen && make docsgen-cli docsgen-config` to generate documentation - [ ] Create a draft PR with title `build: release Lotus {{$.Type}} v{{$.Tag}}{{$tagSuffix}}` - Link to PR: - Opening a PR will trigger a CI run that will build assets, create a draft GitHub release, and attach the assets. diff --git a/scripts/docsgen-cli/main.go b/scripts/docsgen-cli/main.go index 58478fc3e84..fd557efb47b 100644 --- a/scripts/docsgen-cli/main.go +++ b/scripts/docsgen-cli/main.go @@ -45,7 +45,12 @@ func main() { os.Exit(1) } - fmt.Println("Generating CLI documentation...") + // Some help output is generated based on whether the output is a terminal or not. To make stable + // output text, we set Stdout to not be a terminal while we load the CLI apps and reset it + // before generating the documentation. + _, w, _ := os.Pipe() + stdout := os.Stdout + os.Stdout = w cliApps := map[string]*cli.App{ "lotus": lotus.App(), @@ -53,6 +58,11 @@ func main() { "lotus-miner": miner.App(), } + w.Close() + os.Stdout = stdout + + fmt.Println("Generating CLI documentation...") + for name, app := range cliApps { for _, cmd := range app.Commands { cmd.HelpName = fmt.Sprintf("%s %s", app.HelpName, cmd.Name)