Compare commits

...

3 Commits

Author SHA1 Message Date
cuddle-please
b8dabdd8f3 chore(release): 0.2.3
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-09-26 19:39:38 +00: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
7 changed files with 46 additions and 6 deletions

View File

@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [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 ## [0.2.2] - 2024-09-23
### Other ### Other

4
Cargo.lock generated
View File

@ -122,9 +122,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.82" version = "0.1.83"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]
version = "0.2.2" version = "0.2.3"
[workspace.dependencies] [workspace.dependencies]

View File

@ -1,9 +1,16 @@
function git-now { 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) choice=$(gitnow "$@" --no-shell)
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
return $? return $?
fi fi
# Enter local repository path
cd "$(echo "$choice" | tail --lines 1)" cd "$(echo "$choice" | tail --lines 1)"
} }

View File

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

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

@ -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}; use commands::{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;
@ -50,6 +50,7 @@ struct Command {
#[derive(Subcommand)] #[derive(Subcommand)]
enum Commands { enum Commands {
Init(Shell), Init(Shell),
Update(Update),
} }
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml"; const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
@ -80,7 +81,14 @@ async fn main() -> anyhow::Result<()> {
tracing::debug!("Starting cli"); tracing::debug!("Starting cli");
match cli.command { 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 => { None => {
RootCommand::new(app) RootCommand::new(app)
.execute( .execute(