46 Commits

Author SHA1 Message Date
c5245cb7fe feat: some example change
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-01-08 01:10:30 +01:00
cuddle-please
5e97f68a77 chore(release): 0.3.3
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2025-01-07 22:22:43 +00:00
eb684ef8e9 chore: replace dotenv with dotenvy, a slightly more maintained version of the same library (#50)
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #50
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
2025-01-07 23:21:32 +01:00
176dc9f094 chore(release): v0.3.2 (#45)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): 0.3.3

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #45
2025-01-07 23:13:59 +01:00
1b9f8d96fc fix: cargo.lock (#49)
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #49
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
2025-01-07 22:47:49 +01:00
cuddle-please
69d008feb6 chore(release): 0.3.2
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-01-07 22:36:46 +01:00
ada020e283 feat: allow ctrl+c to exit application
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-01-07 22:36:46 +01:00
708180f9a2 fix(deps): update rust crate async-trait to v0.1.85
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-01-07 01:35:21 +00:00
33ba27bf77 chore(release): v0.3.1 (#43)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): 0.3.1

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #43
2025-01-02 09:47:09 +01:00
74a1daac4c chore: enable publish
All checks were successful
continuous-integration/drone/push Build is passing
2025-01-02 09:44:37 +01:00
3bd243b45c chore(release): v0.3.0 (#15)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): 0.3.0

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #15
2025-01-02 09:41:06 +01:00
15620da103 feat: add small help to see how much time is left in cache
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2025-01-01 22:24:27 +01:00
a228ec82a3 chore: bump default cache duration to 7 days
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2025-01-01 22:01:49 +01:00
503680d81c fix(deps): update rust crate serde to v1.0.217
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-28 01:36:56 +00:00
d13dc5b0a2 chore(deps): update rust crate anyhow to v1.0.95
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-23 01:39:03 +00:00
a1a993957b fix(deps): update rust crate serde to v1.0.216
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-11 05:32:18 +00:00
916beffb6d fix(deps): update tokio-prost monorepo to v0.13.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-07 01:38:34 +00:00
291d056dd7 chore(deps): update rust crate clap to v4.5.23
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-06 01:42:46 +00:00
dfacf96967 chore(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-04 01:44:09 +00:00
3524847d9f chore(deps): update rust crate tracing-subscriber to v0.3.19
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-30 02:14:09 +00:00
48b77deb5c fix(deps): update rust crate bytes to v1.9.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-29 01:30:54 +00:00
c3f626cce0 chore(deps): update rust crate tracing to v0.1.41
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-28 01:38:56 +00:00
52d522107d fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-23 01:38:40 +00:00
4dd8e58122 fix(deps): update rust crate octocrab to 0.42.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-15 01:31:30 +00:00
aa399e11c1 chore(deps): update rust crate clap to v4.5.21
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-14 01:32:34 +00:00
e670dc0384 fix(deps): update rust crate serde to v1.0.215
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-12 01:29:59 +00:00
8eb2970f5d chore(deps): update rust crate tokio to v1.41.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-08 01:31:47 +00:00
f94ef8e919 chore(deps): update rust crate anyhow to v1.0.93
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-07 01:31:24 +00:00
62c9166677 fix(deps): update rust crate url to v2.5.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-05 01:29:20 +00:00
5e859f99a9 chore(deps): update rust crate anyhow to v1.0.92
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-02 01:35:49 +00:00
4d78609839 fix(deps): update rust crate serde to v1.0.214
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-29 01:38:16 +00:00
90b7fe9b03 fix(deps): update rust crate serde to v1.0.213
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-23 04:39:58 +00:00
79ad2e872c chore(deps): update all dependencies to v1.0.91
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-23 00:39:42 +00:00
ab963600f3 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-22 00:31:58 +00:00
1aab9c2970 chore(deps): update rust crate anyhow to v1.0.90
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-19 00:35:28 +00:00
9dfcb52010 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-17 00:36:47 +00:00
659f2247ff fix(deps): update rust crate octocrab to v0.41.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-11 00:32:54 +00:00
76f82f9060 chore(deps): update rust crate clap to v4.5.20
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-09 00:34:52 +00:00
bdfd001458 fix(deps): update rust crate futures to v0.3.31
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-06 00:31:44 +00:00
f4a2b52c72 chore(deps): update rust crate clap to v4.5.19
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-02 00:34:42 +00:00
aa78933f0e fix(deps): update rust crate octocrab to 0.41.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-01 00:34:35 +00:00
b242128d52 chore(release): v0.2.3 (#12)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): 0.2.3

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #12
2024-09-26 21:41:11 +02:00
17cb06904f feat: add update command
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-26 21:36:03 +02:00
e3292b0c73 fix(deps): update rust crate async-trait to v0.1.83
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2024-09-25 00:35:40 +00:00
cc70131101 feat: only do clone if not exists
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-24 08:38:13 +02:00
784c7303a5 fix(deps): update rust crate octocrab to 0.40.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-09-24 00:35:26 +00:00
14 changed files with 839 additions and 442 deletions

View File

@@ -6,6 +6,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.3.3] - 2025-01-07
### Other
- replace dotenv with dotenvy, a slightly more maintained version of the same library (#50)
## [0.3.2] - 2025-01-07
### Fixed
- *(deps)* update rust crate async-trait to v0.1.85
## [0.3.1] - 2025-01-02
### Other
- enable publish
## [0.3.0] - 2025-01-01
### Added
- add small help to see how much time is left in cache
### Fixed
- *(deps)* update rust crate serde to v1.0.217
- *(deps)* update rust crate serde to v1.0.216
- *(deps)* update tokio-prost monorepo to v0.13.4
- *(deps)* update rust crate bytes to v1.9.0
- *(deps)* update all dependencies
- *(deps)* update rust crate octocrab to 0.42.0
- *(deps)* update rust crate serde to v1.0.215
- *(deps)* update rust crate url to v2.5.3
- *(deps)* update rust crate serde to v1.0.214
- *(deps)* update rust crate serde to v1.0.213
- *(deps)* update all dependencies
- *(deps)* update all dependencies
- *(deps)* update rust crate octocrab to v0.41.1
- *(deps)* update rust crate futures to v0.3.31
- *(deps)* update rust crate octocrab to 0.41.0
### Other
- bump default cache duration to 7 days
- *(deps)* update rust crate anyhow to v1.0.95
- *(deps)* update rust crate clap to v4.5.23
- *(deps)* update all dependencies
- *(deps)* update rust crate tracing-subscriber to v0.3.19
- *(deps)* update rust crate tracing to v0.1.41
- *(deps)* update rust crate clap to v4.5.21
- *(deps)* update rust crate tokio to v1.41.1
- *(deps)* update rust crate anyhow to v1.0.93
- *(deps)* update rust crate anyhow to v1.0.92
- *(deps)* update all dependencies to v1.0.91
- *(deps)* update rust crate anyhow to v1.0.90
- *(deps)* update rust crate clap to v4.5.20
- *(deps)* update rust crate clap to v4.5.19
## [0.2.3] - 2024-09-26
### Added
- add update command
- only do clone if not exists
### Fixed
- *(deps)* update rust crate async-trait to v0.1.83
- *(deps)* update rust crate octocrab to 0.40.0
## [0.2.2] - 2024-09-23
### Other

1110
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.2.2"
version = "0.3.3"
[workspace.dependencies]
@@ -12,4 +12,4 @@ tokio = { version = "1", features = ["full"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
clap = { version = "4", features = ["derive", "env"] }
dotenv = { version = "0.15" }
dotenvy = { version = "0.15.7" }

View File

@@ -1,5 +1,7 @@
# Git Now
Some example change
Git Now is a utility for easily navigating git projects from common upstream providers. Search, Download, and Enter projects as quickly as you can type.
![example gif](./assets/gifs/example.gif)

View File

@@ -17,7 +17,7 @@ tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde = { version = "1.0.197", features = ["derive"] }
uuid = { version = "1.7.0", features = ["v4"] }
@@ -26,13 +26,13 @@ toml = "0.8.19"
gitea-client = { version = "1.22.1" }
url = "2.5.2"
octocrab = "0.39.0"
octocrab = "0.42.0"
dirs = "5.0.1"
prost = "0.13.2"
prost-types = "0.13.2"
bytes = "1.7.1"
nucleo-matcher = "0.3.1"
ratatui = { version = "0.28.1", features = ["termwiz"] }
ratatui = { version = "0.29.0", features = ["termwiz"] }
crossterm = { version = "0.28.0", features = ["event-stream"] }
futures = "0.3.30"
termwiz = "0.22.0"

View File

@@ -1,9 +1,16 @@
function git-now {
# Run an update in the background
(
nohup gitnow update > /dev/null 2>&1 &
)
# Find the repository of choice
choice=$(gitnow "$@" --no-shell)
if [[ $? -ne 0 ]]; then
return $?
fi
# Enter local repository path
cd "$(echo "$choice" | tail --lines 1)"
}

View File

@@ -79,6 +79,11 @@ impl Cache {
tracing::debug!("cache has expired");
return Ok(None);
}
tracing::debug!(
"cache is valid for: {} mins",
cache_duration.saturating_sub(file_modified_last).as_secs() / 60
);
}
}

View File

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

View File

@@ -85,26 +85,37 @@ impl RootCommand {
}
};
if clone {
let git_clone = self.app.git_clone();
let project_path = self
.app
.config
.settings
.projects
.directory
.join(repo.to_rel_path());
if !project_path.exists() {
if clone {
let git_clone = self.app.git_clone();
if std::io::stdout().is_terminal() && shell {
let mut wrap_cmd =
InlineCommand::new(format!("cloning: {}", repo.to_rel_path().display()));
let repo = repo.clone();
wrap_cmd
.execute(move || async move {
git_clone.clone_repo(&repo, force_refresh).await?;
if std::io::stdout().is_terminal() && shell {
let mut wrap_cmd =
InlineCommand::new(format!("cloning: {}", repo.to_rel_path().display()));
let repo = repo.clone();
wrap_cmd
.execute(move || async move {
git_clone.clone_repo(&repo, force_refresh).await?;
Ok(())
})
.await?;
Ok(())
})
.await?;
} else {
eprintln!("cloning repository...");
git_clone.clone_repo(&repo, force_refresh).await?;
}
} else {
eprintln!("cloning repository...");
git_clone.clone_repo(&repo, force_refresh).await?;
tracing::info!("skipping clone for repo: {}", &repo.to_rel_path().display());
}
} else {
tracing::info!("skipping clone for repo: {}", &repo.to_rel_path().display());
tracing::info!("repository already exists");
}
if shell {

View File

@@ -0,0 +1,14 @@
use crate::{app::App, cache::CacheApp, projects_list::ProjectsListApp};
#[derive(clap::Parser)]
pub struct Update {}
impl Update {
pub async fn execute(&mut self, app: &'static App) -> anyhow::Result<()> {
let repositories = app.projects_list().get_projects().await?;
app.cache().update(&repositories).await?;
Ok(())
}
}

View File

@@ -124,7 +124,7 @@ impl CacheDuration {
impl Default for CacheDuration {
fn default() -> Self {
Self::Precise {
days: 1,
days: 7,
hours: 0,
minutes: 0,
}

View File

@@ -36,6 +36,7 @@ impl InteractiveApp for &'static crate::app::App {
}
mod app {
use crossterm::event::KeyModifiers;
use ratatui::{
crossterm::event::{self, Event, KeyCode},
layout::{Constraint, Layout},
@@ -92,6 +93,12 @@ mod app {
terminal.draw(|frame| self.draw(frame))?;
if let Event::Key(key) = event::read()? {
if let KeyCode::Char('c') = key.code {
if key.modifiers.contains(KeyModifiers::CONTROL) {
return Ok(None);
}
}
match key.code {
KeyCode::Char(letter) => {
self.current_search.push(letter);

View File

@@ -4,7 +4,7 @@ use std::path::PathBuf;
use anyhow::Context;
use clap::{Parser, Subcommand};
use commands::{root::RootCommand, shell::Shell};
use commands::{root::RootCommand, shell::Shell, update::Update};
use config::Config;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::EnvFilter;
@@ -50,13 +50,14 @@ struct Command {
#[derive(Subcommand)]
enum Commands {
Init(Shell),
Update(Update),
}
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
dotenvy::dotenv().ok();
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::builder()
@@ -80,7 +81,14 @@ async fn main() -> anyhow::Result<()> {
tracing::debug!("Starting cli");
match cli.command {
Some(Commands::Init(mut shell)) => shell.execute().await?,
Some(cmd) => match cmd {
Commands::Init(mut shell) => {
shell.execute().await?;
}
Commands::Update(mut update) => {
update.execute(app).await?;
}
},
None => {
RootCommand::new(app)
.execute(

View File

@@ -6,6 +6,9 @@ vars:
service: "gitnow"
registry: kasperhermansen
rust:
publish: {}
please:
project:
owner: kjuulh