feat: add clone spinner
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kasper Juul Hermansen 2024-09-23 19:45:23 +02:00
parent 866a8b4c52
commit c9aacf0ecd
Signed by: kjuulh
SSH Key Fingerprint: SHA256:RjXh0p7U6opxnfd3ga/Y9TCo18FYlHFdSpRIV72S/QM
7 changed files with 31 additions and 15 deletions

View File

@ -1 +1,2 @@
pub mod root;
pub mod shell;

View File

@ -29,10 +29,12 @@ impl RootCommand {
clone: bool,
shell: bool,
force_refresh: bool,
force_cache_update: bool,
) -> anyhow::Result<()> {
tracing::debug!("executing");
let repositories = if cache {
let repositories = if !force_cache_update {
if cache {
match self.app.cache().get().await? {
Some(repos) => repos,
None => {
@ -46,6 +48,14 @@ impl RootCommand {
}
} else {
self.app.projects_list().get_projects().await?
}
} else {
tracing::info!("forcing cache update...");
let repositories = self.app.projects_list().get_projects().await?;
self.app.cache().update(&repositories).await?;
repositories
};
let repo = match search {

View File

View File

@ -75,12 +75,6 @@ impl SpinnerState {
if now.duration_since(self.last_event) >= self.interval {
self.last_event = now;
self.next_state();
batch.with(Command::new(|d| {
d.send(Msg::Tick);
None
}));
}
batch

View File

@ -43,6 +43,9 @@ struct Command {
#[arg(long = "force-refresh", default_value = "false")]
force_refresh: bool,
#[arg(long = "force-cache-update", default_value = "false")]
force_cache_update: bool,
}
#[derive(Subcommand)]
@ -87,6 +90,7 @@ async fn main() -> anyhow::Result<()> {
!cli.no_clone,
!cli.no_shell,
cli.force_refresh,
cli.force_cache_update,
)
.await?;
}

View File

@ -21,3 +21,5 @@ scripts:
type: shell
update-gifs:
type: shell
install:
type: shell

5
scripts/install.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env zsh
set -e
cargo install --path crates/gitnow