Open sj14 opened 5 months ago
@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?
Sound reasonable to me, but maybe it can be documented in v2 as it can easily lead to exposed secrets.
@sj14 Thank you! Does any of the work required interest you? 😇
I may create a PR for the documentation but I can't promise 😆
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 here