Compare commits
1 Commits
renovate/t
...
50c4e9c50e
Author | SHA1 | Date | |
---|---|---|---|
50c4e9c50e |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -6,34 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.5] - 2025-03-04
|
||||
|
||||
### Added
|
||||
- allow clone all
|
||||
|
||||
### Fixed
|
||||
- *(deps)* update rust crate serde to v1.0.218
|
||||
- *(deps)* update tokio-prost monorepo to v0.13.5
|
||||
- *(deps)* update rust crate termwiz to 0.23.0
|
||||
- *(deps)* update all dependencies
|
||||
- *(deps)* update rust crate uuid to v1.13.0
|
||||
- *(deps)* update all dependencies
|
||||
- *(deps)* update rust crate async-trait to v0.1.86
|
||||
- *(deps)* update rust crate uuid to v1.12.1
|
||||
- *(deps)* update rust crate octocrab to 0.43.0
|
||||
- *(deps)* update rust crate uuid to v1.12.0
|
||||
- *(deps)* update rust crate dirs to v6
|
||||
- *(deps)* update rust crate uuid to v1.11.1
|
||||
|
||||
### Other
|
||||
- *(deps)* update all dependencies
|
||||
- *(deps)* update all dependencies
|
||||
- *(deps)* update rust crate clap to v4.5.29
|
||||
- *(deps)* update rust crate clap to v4.5.27
|
||||
- *(deps)* update rust crate clap to v4.5.26
|
||||
- *(deps)* update rust crate tokio to v1.43.0
|
||||
- update example
|
||||
|
||||
## [0.3.4] - 2025-01-08
|
||||
|
||||
### Added
|
||||
|
37
Cargo.lock
generated
37
Cargo.lock
generated
@@ -98,9 +98,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.97"
|
||||
version = "1.0.96"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
|
||||
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
@@ -110,9 +110,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.87"
|
||||
version = "0.1.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97"
|
||||
checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -217,9 +217,9 @@ checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.10.1"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
||||
checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
|
||||
|
||||
[[package]]
|
||||
name = "cassowary"
|
||||
@@ -565,7 +565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -798,7 +798,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gitnow"
|
||||
version = "0.3.5"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -815,7 +815,6 @@ dependencies = [
|
||||
"prost",
|
||||
"prost-types",
|
||||
"ratatui",
|
||||
"regex",
|
||||
"serde",
|
||||
"termwiz 0.23.0",
|
||||
"tokio",
|
||||
@@ -1867,9 +1866,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.14.1"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
|
||||
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost-derive",
|
||||
@@ -1877,9 +1876,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-derive"
|
||||
version = "0.14.1"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
|
||||
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools",
|
||||
@@ -1890,9 +1889,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-types"
|
||||
version = "0.14.1"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72"
|
||||
checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16"
|
||||
dependencies = [
|
||||
"prost",
|
||||
]
|
||||
@@ -2094,7 +2093,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2566,7 +2565,7 @@ dependencies = [
|
||||
"getrandom 0.2.15",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3083,9 +3082,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.15.1"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587"
|
||||
checksum = "93d59ca99a559661b96bf898d8fce28ed87935fd2bea9f05983c1464dd6c71b1"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"getrandom 0.3.1",
|
||||
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.3.5"
|
||||
version = "0.3.4"
|
||||
|
||||
[workspace.dependencies]
|
||||
|
||||
|
@@ -28,15 +28,14 @@ gitea-client = { version = "1.22.1" }
|
||||
url = "2.5.2"
|
||||
octocrab = "0.43.0"
|
||||
dirs = "6.0.0"
|
||||
prost = "0.14.0"
|
||||
prost-types = "0.14.0"
|
||||
prost = "0.13.2"
|
||||
prost-types = "0.13.2"
|
||||
bytes = "1.7.1"
|
||||
nucleo-matcher = "0.3.1"
|
||||
ratatui = { version = "0.29.0", features = ["termwiz"] }
|
||||
crossterm = { version = "0.28.0", features = ["event-stream"] }
|
||||
futures = "0.3.30"
|
||||
termwiz = "0.23.0"
|
||||
regex = "1.11.1"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4.0"
|
||||
|
@@ -1,83 +1,3 @@
|
||||
pub mod root;
|
||||
pub mod shell;
|
||||
pub mod update;
|
||||
pub mod clone {
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use futures::future::join_all;
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
app::App, cache::CacheApp, custom_command::CustomCommandApp, git_clone::GitCloneApp,
|
||||
};
|
||||
|
||||
#[derive(clap::Parser)]
|
||||
pub struct CloneCommand {
|
||||
#[arg(long = "search")]
|
||||
search: String,
|
||||
}
|
||||
|
||||
impl CloneCommand {
|
||||
pub async fn execute(&mut self, app: &'static App) -> anyhow::Result<()> {
|
||||
let repos = app.cache().get().await?.ok_or(anyhow::anyhow!(
|
||||
"failed to get cache, do a gitnow update first"
|
||||
))?;
|
||||
|
||||
let search = Regex::new(&self.search)?;
|
||||
|
||||
let filtered_repos = repos
|
||||
.iter()
|
||||
.filter(|r| search.is_match(&r.to_rel_path().display().to_string()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let concurrency_limit = Arc::new(tokio::sync::Semaphore::new(5));
|
||||
let mut handles = Vec::default();
|
||||
for repo in filtered_repos {
|
||||
let config = app.config.clone();
|
||||
let custom_command = app.custom_command();
|
||||
let git_clone = app.git_clone();
|
||||
let repo = repo.clone();
|
||||
let concurrency = Arc::clone(&concurrency_limit);
|
||||
|
||||
let handle = tokio::spawn(async move {
|
||||
let permit = concurrency.acquire().await?;
|
||||
|
||||
let project_path = config.settings.projects.directory.join(repo.to_rel_path());
|
||||
if !project_path.exists() {
|
||||
eprintln!("cloning repository: {}", repo.to_rel_path().display());
|
||||
git_clone.clone_repo(&repo, false).await?;
|
||||
|
||||
custom_command
|
||||
.execute_post_clone_command(&project_path)
|
||||
.await?;
|
||||
}
|
||||
|
||||
drop(permit);
|
||||
|
||||
Ok::<(), anyhow::Error>(())
|
||||
});
|
||||
|
||||
handles.push(handle);
|
||||
}
|
||||
|
||||
let res = join_all(handles).await;
|
||||
|
||||
for res in res {
|
||||
match res {
|
||||
Ok(Ok(())) => {}
|
||||
Ok(Err(e)) => {
|
||||
tracing::error!("failed to clone repo: {}", e);
|
||||
anyhow::bail!(e)
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("failed to clone repo: {}", e);
|
||||
anyhow::bail!(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ use std::path::PathBuf;
|
||||
|
||||
use anyhow::Context;
|
||||
use clap::{Parser, Subcommand};
|
||||
use commands::{clone::CloneCommand, root::RootCommand, shell::Shell, update::Update};
|
||||
use commands::{root::RootCommand, shell::Shell, update::Update};
|
||||
use config::Config;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
@@ -52,7 +52,6 @@ struct Command {
|
||||
enum Commands {
|
||||
Init(Shell),
|
||||
Update(Update),
|
||||
Clone(CloneCommand),
|
||||
}
|
||||
|
||||
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
|
||||
@@ -90,9 +89,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
Commands::Update(mut update) => {
|
||||
update.execute(app).await?;
|
||||
}
|
||||
Commands::Clone(mut clone) => {
|
||||
clone.execute(app).await?;
|
||||
}
|
||||
},
|
||||
None => {
|
||||
RootCommand::new(app)
|
||||
|
Reference in New Issue
Block a user