Skip to content

Commit

Permalink
feat: add spinning progress UX for DataCommand and MetricsCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
spool committed Jul 5, 2024
1 parent ac28eab commit 1dfd016
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
44 changes: 42 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ itertools = "0.13.0"
comfy-table = "7.1.1"
thiserror = "1"
nonempty = { version = "0.10.0", features = ["serialize"] }
spinners = "4.1.1"


[features]
Expand Down
17 changes: 13 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use popgetter::{
Popgetter,
};
use serde::{Deserialize, Serialize};
use spinners::{Spinner, Spinners};
use std::fs::File;
use strum_macros::EnumString;

Expand Down Expand Up @@ -86,12 +87,18 @@ impl RunCommand for DataCommand {
async fn run(&self, config: Config) -> Result<()> {
info!("Running `data` subcommand");

let mut sp = Spinner::new(
Spinners::Dots9,
"Downloading and searching metadata from Azure".into(),
);
let popgetter = Popgetter::new_with_config(config).await?;
let search_results = popgetter.search(self.search_params_args.clone().into());

sp.stop();

let mut data = popgetter
.search(self.search_params_args.clone().into())
.download(&popgetter.config)
.await?;
let mut sp = Spinner::new(Spinners::Dots9, "Download Parquet files".into());
let mut data = search_results.download(&popgetter.config).await?;
sp.stop();

debug!("{data:#?}");

Expand Down Expand Up @@ -259,8 +266,10 @@ impl RunCommand for MetricsCommand {
info!("Running `metrics` subcommand");
debug!("{:#?}", self);

let mut sp = Spinner::new(Spinners::Dots9, "Downloading metadata from Azure".into());
let popgetter = Popgetter::new_with_config(config).await?;
let search_results = popgetter.search(self.search_params_args.clone().into());
sp.stop();

let len_requests = search_results.0.shape().0;
println!("Found {} metrics.", len_requests);
Expand Down

0 comments on commit 1dfd016

Please sign in to comment.