go-arg
go-arg copied to clipboard
Accept only argument as environment variable
Now ignores if the short argument is empty, so we can only accept the environment variable.
I notice that test: TestInvalidShortFlag breaks, but it seems this test was done thinking that it shouldn't support a short flag with more than one character. Thinks like this one: -foo... Not sure if I can remove this test
Closes #179
https://github.com/alexflint/go-arg/blob/f0f44b65d1179ccedb4c56f493f97ec569a6654e/parse_test.go#L232-L238
Result of this test is:
Error Trace: parse_test.go:237
Error: An error is expected but got nil.
Test: TestInvalidShortFlag
Which should be ok, but the name of the test or the idea rear it seems to be incorrect
@padilo thank you for putting this together.
Can you please add some unit tests for the feature you're adding (options that are only settable via environment-variables?). Also please add some tests in usage_test.go so we can see what the usage and help strings look like for arguments that use this feature.
All tests currently pass on master, so I think your change must cause the test breakage in TestInvalidShortFlag
I think I understand what that test is supposed to do... @alexflint seems like the environment-only variables were possible. I just tried to include it in the usage + help.
I'm not sure if the format of usage should be this way. I don't like it at all
Hi @padilo
may I take this over to finish it? Or are you still working on it? I would add you and myself as Co-Author.
These changes were incorporated into #222, which has now been merged