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

Percentage Bar never changes #3

Open
AutomatedTester opened this issue Oct 4, 2015 · 0 comments
Open

Percentage Bar never changes #3

AutomatedTester opened this issue Oct 4, 2015 · 0 comments

Comments

@AutomatedTester
Copy link
Contributor

If you call the program below it finishes with the bar at 0%. Compile the code below and run it

    extern crate argparse;
    extern crate rustbar;

    use argparse::{ArgumentParser, List};
    use rustbar::rustbars::{ProgressBar, PercentageProgressBar};
    use std::thread::sleep_ms;

    fn main() {
        let task;
        let mut tasks_vector: Vec<String> = Vec::new();
        {

            let mut parser = ArgumentParser::new();
            parser.set_description("A CLI tool to do Pomodoro tasks");

            parser.refer(&mut tasks_vector)
                  .add_argument("task", List,
                                "Task that you want to do");

            parser.parse_args_or_exit();

        }
        task = tasks_vector.join(" ");
        let mut progress = PercentageProgressBar::new();
        for idx in 1..25 {
            progress.set_value((idx/25)*100);
            progress.set_msg(&task[..]);
            progress.render();
            sleep_ms(1000);
        }
    }

once run it looks like

dburns in ~/development/learn on master ● λ target/debug/./learn task task
task task0%%                                                                                                                                          dburns in ~/development/learn on master ● λ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant