Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ Cargo.lock

# Cargo about
*.hbs

# Core dump
*.core
3 changes: 3 additions & 0 deletions backpack/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ coverage = []
[dev-dependencies]
test-log = { version = "0.2.17", features = ["trace", "color"] }

[build-dependencies]
vergen = { version = "9.0.6", features = ["time", "cargo", "build", "rustc", "si"] }

[package.metadata.binstall.signing]
algorithm = "minisign"
pubkey = "RWS6/A1iiYtBjU101ofgB5ZBUq+erhj0pAF06delVbHPUiDee7PQvIML"
19 changes: 19 additions & 0 deletions backpack/cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2025 yonasBSD
//
// SPDX-License-Identifier: MIT

use vergen::{BuildBuilder, CargoBuilder, Emitter, RustcBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let build = BuildBuilder::all_build()?;
let cargo = CargoBuilder::all_cargo()?;
let rustc = RustcBuilder::all_rustc()?;

Emitter::default()
.add_instructions(&build)?
.add_instructions(&cargo)?
.add_instructions(&rustc)?
.emit()?;

Ok(())
}
43 changes: 24 additions & 19 deletions backpack/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#[cfg(not(feature = "coverage"))]
use clap::Parser;
use github_rs_lib::{Cli, get_repos, get_token, update_repos};
use github_rs_lib::{Cli, Commands, doctor, get_repos, get_token, update_repos};
use std::error::Error;
use terminal_banner::Banner;
use tracing_subscriber::{Registry, fmt, prelude::*};
Expand Down Expand Up @@ -71,24 +71,29 @@ async fn main() -> Result<(), Box<dyn Error>> {
"Parsed command line arguments"
);

if cli.sync {
tracing::warn!("Sync enabled. This might take a while.");
}

let token = get_token(cli.token.unwrap_or_default()).await?;
tracing::trace!(token = token, "Got GitHub token");

// Get the value of the positional argument (if provided)
let repos = match cli.org {
Some(org) => get_repos(token.clone(), Some(org)).await?,
None => get_repos(token.clone(), None).await?,
};

let count = update_repos(repos, cli.sync, token.clone()).await?;
tracing::trace!(count = count, "Got count of GitHub repos updated");

if count > 0 {
println!("Total updates: {count}");
match &cli.command {
Some(Commands::Doctor {}) => doctor().await.expect("Run doctor"),
None => {
if cli.sync {
tracing::warn!("Sync enabled. This might take a while.");
}

let token = get_token(cli.token.unwrap_or_default()).await?;
tracing::trace!(token = token, "Got GitHub token");

// Get the value of the positional argument (if provided)
let repos = match cli.org {
Some(org) => get_repos(token.clone(), Some(org)).await?,
None => get_repos(token.clone(), None).await?,
};

let count = update_repos(repos, cli.sync, token.clone()).await?;
tracing::trace!(count = count, "Got count of GitHub repos updated");

if count > 0 {
println!("Total updates: {count}");
}
}
}

Ok(())
Expand Down
9 changes: 9 additions & 0 deletions backpack/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2025 yonasBSD
#
# SPDX-License-Identifier: MIT

default: build

@build:
clear
cargo build --release --package github-rs && ../target/release/github-rs doctor
17 changes: 15 additions & 2 deletions backpack/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ name = "github-rs-lib"
version = "0.1.0"
edition = "2024"
license = "MIT"
authors = ["Yonas Yanfa", "Yonas Yanfa <no-reply@example.com>"]
description = "Automatically update all your forked repositories on Github."
homepage = "https://github.com/yonasBSD/github-rs"
repository = "https://github.com/yonasBSD/github-rs"
keywords = ["github", "git"]
categories = ["github", "git"]

[features]
coverage = []
Expand All @@ -20,11 +25,19 @@ which = "8.0.0"
config = "0.15.4"
xdg = "3.0.0"
reqwest = { version = "0.12.9", default-features = false, features = ["blocking", "hickory-dns", "json", "rustls-tls"] }
env_logger = "0.11.5"
#env_logger = "0.11.5"
tracing = { version = "0.1.41", features = ["log"] }
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] }
terminal-banner = { version = "0.4.1", features = ["color"] }
serde_json5 = "0.2.1"
dns-lookup = "2.0.4"
rdap_client = "0.2.0"
taplo = { version = "0.14.0", features = ["schema", "schemars"] }
uuid = { version = "1.17.0", features = ["v4"] }

[dev-dependencies]
test-log = { version = "0.2.17", features = ["trace", "color"] }
serde_json5 = "0.2.1"

[build-dependencies]
build-data = "0.3.3"
vergen = { version = "9.0.6", features = ["time", "cargo", "build", "rustc", "si"] }
27 changes: 27 additions & 0 deletions backpack/lib/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2025 yonasBSD
*
* SPDX-License-Identifier: MIT
*/

use vergen::{BuildBuilder, CargoBuilder, Emitter, RustcBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let build = BuildBuilder::all_build()?;
let cargo = CargoBuilder::all_cargo()?;
let rustc = RustcBuilder::all_rustc()?;

Emitter::default()
.add_instructions(&build)?
.add_instructions(&cargo)?
.add_instructions(&rustc)?
.emit()?;

build_data::set_GIT_BRANCH().unwrap();
build_data::set_GIT_COMMIT().unwrap();
build_data::set_GIT_DIRTY().unwrap();
build_data::set_SOURCE_TIMESTAMP().unwrap();
build_data::no_debug_rebuilds().unwrap();

Ok(())
}
Loading
Loading