Compare commits
23 Commits
v0.3.4
...
04ef6ede9e
Author | SHA1 | Date | |
---|---|---|---|
04ef6ede9e | |||
167d71024d | |||
|
e2102bfd99 | ||
716adfab8b | |||
c77a9dcbef | |||
7077c623ca | |||
80614fa667 | |||
6ff93b100a | |||
76b617fc2d | |||
d699432f14 | |||
5c46cca96f | |||
8d071981a3 | |||
8f9e40b98f | |||
98d4402461 | |||
816a65a04c | |||
d893e7e21a | |||
2a3c4fbb83 | |||
9d459f10d5 | |||
5aa5702272 | |||
45b45420f8 | |||
b49da1ca71 | |||
3c63992632 | |||
aaf9cd414e |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -6,6 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [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
|
## [0.3.4] - 2025-01-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
518
Cargo.lock
generated
518
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.4"
|
version = "0.3.5"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|
||||||
|
@@ -22,20 +22,21 @@ dotenvy.workspace = true
|
|||||||
serde = { version = "1.0.197", features = ["derive"] }
|
serde = { version = "1.0.197", features = ["derive"] }
|
||||||
uuid = { version = "1.7.0", features = ["v4"] }
|
uuid = { version = "1.7.0", features = ["v4"] }
|
||||||
async-trait = "0.1.82"
|
async-trait = "0.1.82"
|
||||||
toml = "0.8.19"
|
toml = "0.9.0"
|
||||||
|
|
||||||
gitea-client = { version = "1.22.1" }
|
gitea-client = { version = "1.22.1" }
|
||||||
url = "2.5.2"
|
url = "2.5.2"
|
||||||
octocrab = "0.42.0"
|
octocrab = "0.44.0"
|
||||||
dirs = "5.0.1"
|
dirs = "6.0.0"
|
||||||
prost = "0.13.2"
|
prost = "0.13.2"
|
||||||
prost-types = "0.13.2"
|
prost-types = "0.13.2"
|
||||||
bytes = "1.7.1"
|
bytes = "1.7.1"
|
||||||
nucleo-matcher = "0.3.1"
|
nucleo-matcher = "0.3.1"
|
||||||
ratatui = { version = "0.29.0", features = ["termwiz"] }
|
ratatui = { version = "0.29.0", features = ["termwiz"] }
|
||||||
crossterm = { version = "0.28.0", features = ["event-stream"] }
|
crossterm = { version = "0.29.0", features = ["event-stream"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
termwiz = "0.22.0"
|
termwiz = "0.23.0"
|
||||||
|
regex = "1.11.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "1.4.0"
|
pretty_assertions = "1.4.0"
|
||||||
|
@@ -1,3 +1,83 @@
|
|||||||
pub mod root;
|
pub mod root;
|
||||||
pub mod shell;
|
pub mod shell;
|
||||||
pub mod update;
|
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 anyhow::Context;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use commands::{root::RootCommand, shell::Shell, update::Update};
|
use commands::{clone::CloneCommand, root::RootCommand, shell::Shell, update::Update};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use tracing::level_filters::LevelFilter;
|
use tracing::level_filters::LevelFilter;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
@@ -52,6 +52,7 @@ struct Command {
|
|||||||
enum Commands {
|
enum Commands {
|
||||||
Init(Shell),
|
Init(Shell),
|
||||||
Update(Update),
|
Update(Update),
|
||||||
|
Clone(CloneCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
|
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
|
||||||
@@ -89,6 +90,9 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
Commands::Update(mut update) => {
|
Commands::Update(mut update) => {
|
||||||
update.execute(app).await?;
|
update.execute(app).await?;
|
||||||
}
|
}
|
||||||
|
Commands::Clone(mut clone) => {
|
||||||
|
clone.execute(app).await?;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
RootCommand::new(app)
|
RootCommand::new(app)
|
||||||
|
@@ -1,7 +1,31 @@
|
|||||||
|
[settings]
|
||||||
|
# Runs after a project is fetched for the first time, either a single string, or multiple in an array
|
||||||
|
post_clone_command = "jj git init --colocate"
|
||||||
|
# Runs after a project is jumped to if it already exists.
|
||||||
|
post_update_command = ["git pull", "jj git fetch"]
|
||||||
|
|
||||||
[[providers.github]]
|
[[providers.github]]
|
||||||
|
# Who is the user running the clone command
|
||||||
|
current_user = "kjuulh"
|
||||||
|
# How to authenticate to github
|
||||||
|
access_token = { env = "GITHUB_ACCESS_TOKEN" }
|
||||||
|
|
||||||
|
# Which users to index
|
||||||
users = ["kjuulh"]
|
users = ["kjuulh"]
|
||||||
|
# Which organisations to index
|
||||||
organisations = ["lunarway"]
|
organisations = ["lunarway"]
|
||||||
|
|
||||||
[[providers.gitea]]
|
[[providers.gitea]]
|
||||||
|
# WHich gitea instance to authenticate against
|
||||||
|
url = "https://git.front.kjuulh.io/api/v1"
|
||||||
|
|
||||||
|
# How to authenticate to gitea
|
||||||
|
current_user = "kjuulh"
|
||||||
|
|
||||||
|
# WHich token to use to authenticate
|
||||||
|
access_token = { env = "GITEA_ACCESS_TOKEN" }
|
||||||
|
|
||||||
|
# Which users to index
|
||||||
users = ["kjuulh"]
|
users = ["kjuulh"]
|
||||||
|
# Which organisations to index
|
||||||
organisation = ["noorgplease"]
|
organisation = ["noorgplease"]
|
||||||
|
Reference in New Issue
Block a user