grpcurl icon indicating copy to clipboard operation
grpcurl copied to clipboard

Switch from native flags to posix flags

Open andrewbenton opened this issue 5 years ago • 2 comments

This is beneficial because it makes grpcurl more like curl. Many more flags are now common between grpcurl and curl which will help users that are new to the tool.

andrewbenton avatar Aug 09 '19 10:08 andrewbenton

@andrewbenton, does this require long flag names to use two dashes and only allows short flag names with a single dash? If so, this is not backwards-compatible and will be a serious breaking change for anyone that has scripts that reference this tool.

I know the flag-handling is awkward due to the standard Go flag package, but I don't want to replace it with something that won't be backwards-compatible. My personal preference is just to swap for an implementation that allows flag aliases (e.g. multiple names for the same flag -- to support and short and long names) and that allows the arguments to be mixed in with flags, vs. having to come at the end. That would likely make it "close enough" to curl, but also preserve backwards-compatibility, especially since the existing flag support allows either one or two dashes for each flag. So users that were used to two dashes for long names and one dash for short names could still be accommodated.

jhump avatar Aug 09 '19 13:08 jhump

There might be some other library that's able to accept the single dash as well as the double dashed form of the argument. I'll have to see what I can find. Under posix flags, something like -proto is actually treated as all of the single letter flags p, r, o, t, and o again. Given that, we need a library that isn't posix flags if we want to keep that backward compatibility.

andrewbenton avatar Aug 09 '19 20:08 andrewbenton