-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add spinner to commands that install dependencies
- Loading branch information
Rickard Natt och Dag
committed
Nov 20, 2020
1 parent
dd1ecd4
commit 4ced519
Showing
5 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ handlebars = "3.5.1" | |
dialoguer = "0.7.1" | ||
colored = "2.0.0" | ||
include-dir-macro = "0.2" | ||
indicatif = "0.15.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod helpers; | ||
pub mod progressbar; | ||
pub mod template; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use indicatif::{ProgressBar, ProgressStyle}; | ||
|
||
pub struct Spinner { | ||
spinner: ProgressBar, | ||
} | ||
|
||
impl Spinner { | ||
pub fn new() -> Spinner { | ||
let spinner = ProgressBar::new_spinner(); | ||
|
||
spinner.enable_steady_tick(120); | ||
|
||
Spinner { spinner } | ||
} | ||
|
||
pub fn set_message(&self, msg: &str) { | ||
self.spinner.set_message(msg); | ||
} | ||
|
||
pub fn success(&self, msg: &str) { | ||
self.spinner | ||
.set_style(ProgressStyle::default_spinner().template("{msg:.green}")); | ||
self.spinner.finish_with_message(msg); | ||
} | ||
} |