jawher / mow.cli

A versatile library for building CLI applications in Go
MIT License
871 stars 55 forks source link

CLI parsing chokes when optional value contains `=` char #74

Closed coriolinus closed 6 years ago

coriolinus commented 6 years ago

I'm writing an application that needs to be able to receive base64-encoded data on the command line. However, mow.cli apparently doesn't like that base64 data uses equal signs for padding. Example (slightly modified to preserve NDA'd info):

$ ex --ns='9bu+xgWuYTq+5kYjWvGNKWC4kF3oFQDLcugyvomXTZk='
Error: incorrect usage
...

I believe that this is an issue with equal padding and not other some misconfiguration because trimming the last quartet causes a logic error farther into the program:

$ ex --ns='9bu+xgWuYTq+5kYjWvGNKWC4kF3oFQDLcugyvomX'
namespace must have size 32; found 30

The workaround is clear enough in my case: document that the CLI expects its values stripped of padding, and then insert any necessary padding in the logical portion of the program. However, it would be good if mow.cli were capable of handling this input in the future.

jawher commented 6 years ago

Thank you for raising the issue.

I'll look into it !