Replies: 2 comments 1 reply
-
| 
         Another workaround is to flip the arguments e.g. 
 This test is passing     [Theory]
    [InlineData(true)]
    [InlineData(false)]
    public void Should_Override_Default_Value_For_CommandOptionOrdering(bool strictParsing)
    {
        // Given
        var app = new CommandAppTester();
        app.Configure(config =>
        {
            config.Settings.StrictParsing = strictParsing;
            config.PropagateExceptions();
            config.AddBranch<BranchSettings>("branch", branch =>
            {
                branch.AddCommand<BranchCommand>("cut");
            });
        });
        // When
        var result = app.Run(new[]
        {
            "branch", "cut", "--limit", "1567",
        });
        // Then
        result.ExitCode.ShouldBe(0);
        var settings = result.Settings.ShouldBeOfType<BranchSettings>();
        settings.Limit.ShouldBe(1567);
    } | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When adding a
DefaultValueit overrides the value being passed to the command line, seeShould_Override_Default_Value_For_CommandOption.Debug
I've tried to debug the code but I don't have full picture, but I've noticed two things.
First we're setting the value
1567from the command line, later in the execution path we override that value with the default value10.There's some kind guard trying to make sure that we're not adding adding the parameter as unmapped but
Mappedis empty during the second phase of the execution.I've tried the test below with
0.46.0but it's not working so it's not a new regression at least.This might be a potential bug or it might be a miss-configuration from my side?
Workaround
Failing test
Beta Was this translation helpful? Give feedback.
All reactions