Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hakoerber committed Nov 30, 2024
2 parents 30a448a + 5b15baa commit 9dc557a
Show file tree
Hide file tree
Showing 18 changed files with 592 additions and 579 deletions.
154 changes: 96 additions & 58 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git-repo-manager"
version = "0.7.21"
version = "0.7.22"
edition = "2021"

authors = [
Expand Down Expand Up @@ -46,7 +46,7 @@ path = "src/grm/main.rs"
version = "=0.8.19"

[dependencies.serde]
version = "=1.0.214"
version = "=1.0.215"
features = ["derive"]

[dependencies.git2]
Expand All @@ -56,7 +56,7 @@ version = "=0.19.0"
version = "=3.1.0"

[dependencies.clap]
version = "=4.5.20"
version = "=4.5.21"
features = ["derive", "cargo"]

[dependencies.console]
Expand All @@ -66,16 +66,16 @@ version = "=0.15.8"
version = "=1.11.1"

[dependencies.comfy-table]
version = "=7.1.1"
version = "=7.1.3"

[dependencies.serde_yaml]
version = "=0.9.34"

[dependencies.serde_json]
version = "=1.0.132"
version = "=1.0.133"

[dependencies.ureq]
version = "=2.10.1"
version = "=2.11.0"
features = ["json"]

[dependencies.parse_link_header]
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
if let Ok(v) = std::env::var("GRM_RELEASE_VERSION") {
println!("cargo:rustc-env=CARGO_PKG_VERSION={}", v);
println!("cargo:rustc-env=CARGO_PKG_VERSION={v}");
}
println!("cargo:rerun-if-env-changed=GRM_RELEASE_VERSION");
}
6 changes: 4 additions & 2 deletions pkg/arch/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pkgbase = grm-git
pkgdesc = Manage git repos, worktrees and integrate with GitHub and GitLab
pkgver = 0.7.15.r6.gea7299a
pkgrel = 2
pkgver = 0.7.21.r1.gfcd315b
pkgrel = 1
url = https://github.com/hakoerber/git-repo-manager
arch = x86_64
license = GPL-3.0-only
Expand All @@ -14,6 +14,8 @@ pkgbase = grm-git
depends = openssl
provides = grm
conflicts = grm
options = !lto
options = !debug
source = grm-git::git+https://github.com/hakoerber/git-repo-manager#branch=develop
sha256sums = SKIP

Expand Down
8 changes: 4 additions & 4 deletions pkg/arch/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Maintainer: Hannes Körber <[email protected]>
pkgname='grm-git'
pkgver=0.7.15.r6.gea7299a
pkgrel=2
pkgver=0.7.21.r1.gfcd315b
pkgrel=1
pkgdesc='Manage git repos, worktrees and integrate with GitHub and GitLab'
arch=('x86_64')
url='https://github.com/hakoerber/git-repo-manager'
Expand All @@ -12,6 +12,8 @@ provides=('grm')
conflicts=('grm')
source=("${pkgname}::git+https://github.com/hakoerber/git-repo-manager#branch=develop")
sha256sums=('SKIP')
# https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/issues/20
options=(!lto !debug)

pkgver() {
cd "${pkgname}"
Expand All @@ -29,8 +31,6 @@ build() {
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
export GRM_RELEASE_VERSION="${pkgver}"
# https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/issues/20
export CFLAGS+=' -ffat-lto-objects'
cargo build --frozen --release
}

Expand Down
12 changes: 6 additions & 6 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ pub fn get_token_from_command(command: &str) -> Result<AuthToken, String> {
.arg("-c")
.arg(command)
.output()
.map_err(|error| format!("Failed to run token-command: {}", error))?;
.map_err(|error| format!("Failed to run token-command: {error}"))?;

let stderr = String::from_utf8(output.stderr).map_err(|error| error.to_string())?;
let stdout = String::from_utf8(output.stdout).map_err(|error| error.to_string())?;

if !output.status.success() {
if !stderr.is_empty() {
return Err(format!("Token command failed: {}", stderr));
return if !stderr.is_empty() {
Err(format!("Token command failed: {stderr}"))
} else {
return Err(String::from("Token command failed."));
}
Err(String::from("Token command failed."))
};
}

if !stderr.is_empty() {
return Err(format!("Token command produced stderr: {}", stderr));
return Err(format!("Token command produced stderr: {stderr}"));
}

if stdout.is_empty() {
Expand Down
28 changes: 11 additions & 17 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ impl ConfigTrees {
}

pub fn from_vec(vec: Vec<ConfigTree>) -> Self {
ConfigTrees { trees: vec }
Self { trees: vec }
}

pub fn from_trees(vec: Vec<tree::Tree>) -> Self {
ConfigTrees {
Self {
trees: vec.into_iter().map(ConfigTree::from_tree).collect(),
}
}
Expand All @@ -159,12 +159,12 @@ impl ConfigTrees {
impl Config {
pub fn trees(self) -> Result<Vec<ConfigTree>, String> {
match self {
Config::ConfigTrees(config) => Ok(config.trees),
Config::ConfigProvider(config) => {
Self::ConfigTrees(config) => Ok(config.trees),
Self::ConfigProvider(config) => {
let token = match auth::get_token_from_command(&config.token_command) {
Ok(token) => token,
Err(error) => {
print_error(&format!("Getting token from command failed: {}", error));
print_error(&format!("Getting token from command failed: {error}"));
process::exit(1);
}
};
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Config {
match provider::Github::new(filter, token, config.api_url) {
Ok(provider) => provider,
Err(error) => {
print_error(&format!("Error: {}", error));
print_error(&format!("Error: {error}"));
process::exit(1);
}
}
Expand All @@ -208,7 +208,7 @@ impl Config {
match provider::Gitlab::new(filter, token, config.api_url) {
Ok(provider) => provider,
Err(error) => {
print_error(&format!("Error: {}", error));
print_error(&format!("Error: {error}"));
process::exit(1);
}
}
Expand Down Expand Up @@ -243,11 +243,11 @@ impl Config {
}

pub fn from_trees(trees: Vec<ConfigTree>) -> Self {
Config::ConfigTrees(ConfigTrees { trees })
Self::ConfigTrees(ConfigTrees { trees })
}

pub fn normalize(&mut self) {
if let Config::ConfigTrees(config) = self {
if let Self::ConfigTrees(config) = self {
let home = path::env_home();
for tree in &mut config.trees_mut().iter_mut() {
if tree.root.starts_with(&home) {
Expand Down Expand Up @@ -310,8 +310,7 @@ where
Ok(s) => s,
Err(e) => {
return Err(format!(
"Error reading configuration file \"{}\": {}",
path,
"Error reading configuration file \"{path}\": {}",
match e.kind() {
std::io::ErrorKind::NotFound => String::from("not found"),
_ => e.to_string(),
Expand All @@ -324,12 +323,7 @@ where
Ok(c) => c,
Err(_) => match serde_yaml::from_str(&content) {
Ok(c) => c,
Err(e) => {
return Err(format!(
"Error parsing configuration file \"{}\": {}",
path, e
))
}
Err(e) => return Err(format!("Error parsing configuration file \"{path}\": {e}",)),
},
};

Expand Down
Loading

0 comments on commit 9dc557a

Please sign in to comment.