feat: add clone spinner
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
866a8b4c52
commit
c9aacf0ecd
@ -1 +1,2 @@
|
|||||||
pub mod root;
|
pub mod root;
|
||||||
|
pub mod shell;
|
||||||
|
@ -29,23 +29,33 @@ impl RootCommand {
|
|||||||
clone: bool,
|
clone: bool,
|
||||||
shell: bool,
|
shell: bool,
|
||||||
force_refresh: bool,
|
force_refresh: bool,
|
||||||
|
force_cache_update: bool,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
tracing::debug!("executing");
|
tracing::debug!("executing");
|
||||||
|
|
||||||
let repositories = if cache {
|
let repositories = if !force_cache_update {
|
||||||
match self.app.cache().get().await? {
|
if cache {
|
||||||
Some(repos) => repos,
|
match self.app.cache().get().await? {
|
||||||
None => {
|
Some(repos) => repos,
|
||||||
tracing::info!("finding repositories...");
|
None => {
|
||||||
let repositories = self.app.projects_list().get_projects().await?;
|
tracing::info!("finding repositories...");
|
||||||
|
let repositories = self.app.projects_list().get_projects().await?;
|
||||||
|
|
||||||
self.app.cache().update(&repositories).await?;
|
self.app.cache().update(&repositories).await?;
|
||||||
|
|
||||||
repositories
|
repositories
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.app.projects_list().get_projects().await?
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.app.projects_list().get_projects().await?
|
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 {
|
let repo = match search {
|
||||||
|
0
crates/gitnow/src/commands/shell.rs
Normal file
0
crates/gitnow/src/commands/shell.rs
Normal file
@ -75,12 +75,6 @@ impl SpinnerState {
|
|||||||
if now.duration_since(self.last_event) >= self.interval {
|
if now.duration_since(self.last_event) >= self.interval {
|
||||||
self.last_event = now;
|
self.last_event = now;
|
||||||
self.next_state();
|
self.next_state();
|
||||||
|
|
||||||
batch.with(Command::new(|d| {
|
|
||||||
d.send(Msg::Tick);
|
|
||||||
|
|
||||||
None
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
batch
|
batch
|
||||||
|
@ -43,6 +43,9 @@ struct Command {
|
|||||||
|
|
||||||
#[arg(long = "force-refresh", default_value = "false")]
|
#[arg(long = "force-refresh", default_value = "false")]
|
||||||
force_refresh: bool,
|
force_refresh: bool,
|
||||||
|
|
||||||
|
#[arg(long = "force-cache-update", default_value = "false")]
|
||||||
|
force_cache_update: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@ -87,6 +90,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
!cli.no_clone,
|
!cli.no_clone,
|
||||||
!cli.no_shell,
|
!cli.no_shell,
|
||||||
cli.force_refresh,
|
cli.force_refresh,
|
||||||
|
cli.force_cache_update,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -21,3 +21,5 @@ scripts:
|
|||||||
type: shell
|
type: shell
|
||||||
update-gifs:
|
update-gifs:
|
||||||
type: shell
|
type: shell
|
||||||
|
install:
|
||||||
|
type: shell
|
||||||
|
5
scripts/install.sh
Executable file
5
scripts/install.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cargo install --path crates/gitnow
|
Loading…
x
Reference in New Issue
Block a user