feat: Remove the deprecated NamingConventionBinder package and migrate to System.CommandLine#760
Conversation
|
I've literally just finished a first cut at this change myself... Give me a bit to pull this branch and run some tests, I found some... oddities... in the S.CL parsing while I was working on it |
|
This is showing the same weirdness I saw in my branch earlier... try adding and running the the following test: [Fact]
public void CheckParamBinding()
{
// I don't know if this used to work, but it's...weird... now
var command = new MigrateCommand(null!);
var result = command.Parse("-connString=localhost"); // oops, missed a dash
//we'd expect an error here if we looked at result.Errors, no conn string specified
var cfg = command.GetConfiguration(result); // and definitely not expect this to work missing the required value
Assert.Null(cfg.ConnectionString); // and even if it was created in error it wouldn't have a value
}I get |
wokket
left a comment
There was a problem hiding this comment.
First quick review, generally looking really good though as most of these are nits or discussion points,
| // command is being constructed and when it parses, so constructing and parsing must not throw. | ||
| var act = () => | ||
| { | ||
| var command = new MigrateCommand(null!); |
There was a problem hiding this comment.
This test doesn't seem to throw exceptions when given an incorrect command line? It passes even if passed a commandline with dupe options (eg "-ct=10 -ct=100"). If you look at the ParseResult it has the expected error about a missing --connstring etc so maybe that's a better test?
There was a problem hiding this comment.
Change the test case to Assert the error message instead.
There was a problem hiding this comment.
Same thing here, if we can clean up the legacy preconditionals that would be awesome
System.CommandLine supports POSIX-style "attached value" syntax for single-character options: -c means -c with value . So when it sees the single-dash token -connectionString=abc, it matches the -c alias and swallows the remainder — onnectionString=abc — as the option's value. |
wokket
left a comment
There was a problem hiding this comment.
LGTM once the conflicts are resolved/tests go green 👍
ba6737a to
b8b9cfd
Compare
|
@wokket: All checks are passed. CI green now. Thanks. |
Related to #756