Skip to content

Commit 942094c

Browse files
committed
feat: separate docsgen-config Makefile target
still requires compiled binaries to produce the config, separate from docsgen-cli which does not require them
1 parent ed4ea55 commit 942094c

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
- run: git diff --exit-code
3636
- run: make docsgen-cli
3737
- run: git diff --exit-code
38+
- run: make docsgen-config
39+
- run: git diff --exit-code
3840
check-lint:
3941
name: Check (lint-all)
4042
runs-on: ubuntu-latest

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fiximports:
339339

340340
gen: actors-code-gen type-gen cfgdoc-gen docsgen api-gen
341341
$(GOCC) run ./scripts/fiximports
342-
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli'"
342+
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO RUN 'make docsgen-cli' and/or 'make docsgen-config'"
343343
.PHONY: gen
344344

345345
jen: gen
@@ -348,11 +348,15 @@ snap: lotus lotus-miner lotus-worker
348348
snapcraft
349349
# snapcraft upload ./lotus_*.snap
350350

351-
docsgen-cli: lotus lotus-miner lotus-worker
351+
docsgen-cli:
352352
$(GOCC) run ./scripts/docsgen-cli
353+
.PHONY: docsgen-cli
354+
355+
# Compiled lotus and lotus-miner are required to generate the default config files
356+
docsgen-config: lotus lotus-miner
353357
./lotus config default > documentation/en/default-lotus-config.toml
354358
./lotus-miner config default > documentation/en/default-lotus-miner-config.toml
355-
.PHONY: docsgen-cli
359+
.PHONY: docsgen-config
356360

357361
print-%:
358362
@echo $*=$($*)

documentation/en/cli-lotus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ COMMANDS:
4242
4343
GLOBAL OPTIONS:
4444
--color use color in display output (default: depends on output being a TTY)
45-
--interactive setting to false will disable interactive functionality of commands (default: true)
45+
--interactive setting to false will disable interactive functionality of commands (default: false)
4646
--force-send if true, will ignore pre-send checks (default: false)
4747
--vv enables very verbose mode, useful for debugging the CLI (default: false)
4848
--help, -h show help

documentation/misc/Building_a_network_skeleton.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Note: one only needs to update `filecion-ffi`'s dependency on `go-state-types` w
248248
249249
11. Run `make gen`.
250250
251-
12. Run `make docsgen-cli`.
251+
12. Run `make docsgen-cli docsgen-config`.
252252
253253
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:
254254

documentation/misc/RELEASE_ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<!--{{ if contains "Miner" .Type}}-->
7979
- Ensure to update `MinerBuildVersion`
8080
<!--{{ end}}-->
81-
- [ ] Run `make gen && make docsgen-cli` before committing changes.
81+
- [ ] Run `make gen && make docsgen-cli docsgen-config` before committing changes.
8282
- [ ] Update the CHANGELOG
8383
- [ ] Change the `UNRELEASED` section header to `UNRELEASED v{{.Tag}}`
8484
- [ ] 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 @@
118118
<!-- {{if contains "Miner" $.Type}}-->
119119
- Ensure to update `MinerBuildVersion`
120120
<!-- {{end}}-->
121-
- [ ] Run `make gen && make docsgen-cli` to generate documentation
121+
- [ ] Run `make gen && make docsgen-cli docsgen-config` to generate documentation
122122
- [ ] Create a draft PR with title `build: release Lotus {{$.Type}} v{{$.Tag}}{{$tagSuffix}}`
123123
- Link to PR:
124124
- Opening a PR will trigger a CI run that will build assets, create a draft GitHub release, and attach the assets.

scripts/docsgen-cli/main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,24 @@ func main() {
4545
os.Exit(1)
4646
}
4747

48-
fmt.Println("Generating CLI documentation...")
48+
// Some help output is generated based on whether the output is a terminal or not. To make stable
49+
// output text, we set Stdout to not be a terminal while we load the CLI apps and reset it
50+
// before generating the documentation.
51+
_, w, _ := os.Pipe()
52+
stdout := os.Stdout
53+
os.Stdout = w
4954

5055
cliApps := map[string]*cli.App{
5156
"lotus": lotus.App(),
5257
"lotus-worker": worker.App(),
5358
"lotus-miner": miner.App(),
5459
}
5560

61+
w.Close()
62+
os.Stdout = stdout
63+
64+
fmt.Println("Generating CLI documentation...")
65+
5666
for name, app := range cliApps {
5767
for _, cmd := range app.Commands {
5868
cmd.HelpName = fmt.Sprintf("%s %s", app.HelpName, cmd.Name)

0 commit comments

Comments
 (0)