You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TOKEN=my-token URL=my-url go run test/main.go docs
a file called DOCS.man is created with the follwing content:
.nh
.TH main 8
.SH NAME
.PP
main - A new cli application
.SH SYNOPSIS
.PP
main
.EX
[--help|-h]
[--token]=[value]
[--url]=[value]
.EE
.PP
\fBUsage\fP:
.EX
main [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
.EE
.SH GLOBAL OPTIONS
.PP
\fB--help, -h\fP: show help
.PP
\fB--token\fP="": (default: my-token)
.PP
\fB--url\fP="": (default: "http://127.0.0.1")
.SH COMMANDS
.SH help, h
.PP
Shows a list of commands or help for one command
Expected behavior
The token flag should not show the environment variable as the default value.
@sj14 Thank you for reporting this! Differentiating between "unset" and "uninitialized" values, and the precedence of value sources, have long been sources of surprising behavior. I believe that the intended behavior is that flag and env parsing should be completely separate from help text and documentation generation, so I think that treating this as a bug is very fair. I suspect that fixing this the right way will require non-trivial rework of the help text and documentation generation code, which tells me that this work should probably be targeting v3 on the main branch. Does that sound reasonable to you?
My urfave/cli version is v2.27.2
Checklist
Dependency Management
Describe the bug
When you have a flag which can also be set by an env var, and the flag is empty, the value from the env will be used in the output docs markdown.
To reproduce
Observed behavior
When running the example like this
a file called DOCS.man is created with the follwing content:
Expected behavior
The token flag should not show the environment variable as the default value.
Additional context
This happens for the Markdown generation too.
Run
go version
and paste its output hereRun
go env
and paste its output hereThe text was updated successfully, but these errors were encountered: