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 shell;
|
||||
|
@ -29,23 +29,33 @@ impl RootCommand {
|
||||
clone: bool,
|
||||
shell: bool,
|
||||
force_refresh: bool,
|
||||
force_cache_update: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
tracing::debug!("executing");
|
||||
|
||||
let repositories = if cache {
|
||||
match self.app.cache().get().await? {
|
||||
Some(repos) => repos,
|
||||
None => {
|
||||
tracing::info!("finding repositories...");
|
||||
let repositories = self.app.projects_list().get_projects().await?;
|
||||
let repositories = if !force_cache_update {
|
||||
if cache {
|
||||
match self.app.cache().get().await? {
|
||||
Some(repos) => repos,
|
||||
None => {
|
||||
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 {
|
||||
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 {
|
||||
|
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 {
|
||||
self.last_event = now;
|
||||
self.next_state();
|
||||
|
||||
batch.with(Command::new(|d| {
|
||||
d.send(Msg::Tick);
|
||||
|
||||
None
|
||||
}));
|
||||
}
|
||||
|
||||
batch
|
||||
|
@ -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?;
|
||||
}
|
||||
|
@ -21,3 +21,5 @@ scripts:
|
||||
type: shell
|
||||
update-gifs:
|
||||
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…
Reference in New Issue
Block a user