firedancer icon indicating copy to clipboard operation
firedancer copied to clipboard

Support bool flags in fd_env

Open ripatel-fd opened this issue 1 year ago • 5 comments

Problem

Many of our CLI tools use boolean flags, like "verify". Our argument syntax would be either --verify 0 or --verify 1. When passing --verify true though, the true string fails to parse and defaults to 0. I believe many users would find this confusing.

The established convention for argument handling is GNU these days, which would accept --verify (no argument, implying true), --verify false or --verify true. We can leave the old numeric style in for backwards compatibility. We should probably abort with an error if the argument is not recognized though, since the "failed to parse" value and "false" are indistinguishable by return code.

Suggested Fix

  • [ ] Add an int fd_env_strip_cmdline_bool( ... ) function
  • [ ] Update usages

ripatel-fd avatar Feb 02 '24 15:02 ripatel-fd