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
Originally posted by gandro April 15, 2023
Thanks a lot for this wonderfully crafted crate, it's a pleasure to use.
I noticed that while switch() and flag() seem to support env variable fallback, the env variable is not shown in the help output as it is for arguments.
For a bit more context: In my application, I have two options. One allows the user to specify a font directory via path, the other one just tells the application to search for fonts in system directories. I want both options to be have an environment variable fallback, and this seems to work correctly (i.e. the env() call is functional). However, in the generated help output, the environment variable for the flag is not displayed, making it hard for users to discover the env fallback for the system-fonts option.
Here's are the two bpaf parsers:
let fonts_dir = long("fonts").env("OIKOS_FONTS").help("Load fonts from this directory").argument::<PathBuf>("DIR").optional();let system_fonts = long("system-fonts").env("OIKOS_SYSTEM_FONTS").help("Search for additional fonts in system directories").switch();
And here's the currently generated help output:
--fonts <DIR> [env:OIKOS_FONTS: N/A]
Load fonts from this directory
--system-fonts Search for additional fonts in system directories
Where I would love to be able to see something like this:
--fonts <DIR> [env:OIKOS_FONTS: N/A]
Load fonts from this directory
--system-fonts [env:OIKOS_SYSTEM_FONTS: N/A]
Search for additional fonts in system directories
Would something like this be possible?
The text was updated successfully, but these errors were encountered:
Discussed in #198
Originally posted by gandro April 15, 2023
Thanks a lot for this wonderfully crafted crate, it's a pleasure to use.
I noticed that while
switch()
andflag()
seem to support env variable fallback, theenv
variable is not shown in the help output as it is for arguments.For a bit more context: In my application, I have two options. One allows the user to specify a font directory via path, the other one just tells the application to search for fonts in system directories. I want both options to be have an environment variable fallback, and this seems to work correctly (i.e. the
env()
call is functional). However, in the generated help output, the environment variable for the flag is not displayed, making it hard for users to discover the env fallback for thesystem-fonts
option.Here's are the two bpaf parsers:
And here's the currently generated help output:
Where I would love to be able to see something like this:
Would something like this be possible?
The text was updated successfully, but these errors were encountered: