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

Trying to make a progress bar #92

Open
mscteck opened this issue Jul 19, 2020 · 0 comments
Open

Trying to make a progress bar #92

mscteck opened this issue Jul 19, 2020 · 0 comments

Comments

@mscteck
Copy link

mscteck commented Jul 19, 2020

Well hi.
I'm trying to make a progress bar using the edit-line command, but instead of modify the last line that was printed adds a new line or doesn't do anything. It surely is something im doing wrong, or i missunderstood the function of edit-line.
I've modified the code a lot, but this is the function that i have now:

let progressStatus = 0 /// to know if its the first time that executes or not
function progress(cmd){   /// the progress bar string is drawed outside and sent via cmd
  if(cmd === "done"){    /// if the progress bar finished
      progressStatus = 0  /// reset the status flag
  }   else{                         /// if not
     if(progressStatus === 0){     /// if its the first time that the function is executed
       Terminal.terminalObj.printToActive(cmd)   /// send the first line with printToActive
       progressStatus = 1;                                /// turns flag on
     } else{                                                         /// if its not the first time
       Terminal.terminalObj.runCommandOnActive(`edit-line ${cmd}`)  /// update the last line
     }
  }
}
//// The terminalObj is obtained inside the Terminal class with this
ref={(terminal) => { Terminal.terminalObj = terminal; }}

Any help will be apreciated.
Thanks.

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