-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc generation default value set by environment variable #1902
Comments
@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 |
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 hereThe text was updated successfully, but these errors were encountered: