Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request : change total count after creation #2

Closed
Darida opened this issue Mar 19, 2017 · 3 comments
Closed

Feature request : change total count after creation #2

Darida opened this issue Mar 19, 2017 · 3 comments

Comments

@Darida
Copy link

Darida commented Mar 19, 2017

Sometimes you don't know exact count on start. You can have some estimation which accuracy can be improve in process. Would be nice to have a way to change max count after creation.

@goblinfactory
Copy link
Owner

good idea, will look at this now.

@goblinfactory
Copy link
Owner

@Darida feature added, works as follows

    public class SettingMaxShould
    {
        [Test]
        public void update_the_display_using_the_new_max()
        {
            var console = new MockConsole(80, 20);
            var pb = new ProgressBar(10, console);
            pb.Refresh(2, "cats");
            var expected1 = new[]
            {
                "Item 2     of 10   . (20 %) ##########                                          ",
                "cats                                                                            ",
            };
            Assert.AreEqual(expected1, console.BufferWritten);

            pb.Max = 20;
            var expected2 = new[]
            {
                "Item 2     of 20   . (10 %) ##########                                          ",
                "cats                                                                            ",
            };
            Assert.AreEqual(expected2, console.BufferWritten);

        }
    }

will close issue after publishing to nuget.

@goblinfactory goblinfactory changed the title Impossible to change total count after creation Feature request : change total count after creation Mar 20, 2017
@goblinfactory
Copy link
Owner

@Darida done, available in latest nuget package. Please run update-package Goblinfactory.Konsole . The new release is backward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants