syscare/0038-syscare-abi-remove-display-limit-of-patch_info.patch
renoseven aaca4c9c5f update to 1.2.1-10
Signed-off-by: renoseven <dev@renoseven.net>
2024-08-16 16:44:21 +08:00

63 lines
2.5 KiB
Diff

From 6c1d025b3328845377338d6a09b30a23611ba934 Mon Sep 17 00:00:00 2001
From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
Date: Mon, 17 Jun 2024 16:18:20 +0800
Subject: [PATCH] syscare-abi: remove display limit of patch_info
When executing with `syscare info xxx`, show all the patches
it contains.
Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
---
syscare-abi/src/patch_info.rs | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/syscare-abi/src/patch_info.rs b/syscare-abi/src/patch_info.rs
index 246f830..65b7650 100644
--- a/syscare-abi/src/patch_info.rs
+++ b/syscare-abi/src/patch_info.rs
@@ -71,8 +71,6 @@ impl PatchInfo {
impl std::fmt::Display for PatchInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- const LIST_DISPLAY_LIMIT: usize = 9;
-
writeln!(f, "name: {}", self.name)?;
writeln!(f, "version: {}", self.version)?;
writeln!(f, "release: {}", self.release)?;
@@ -84,10 +82,6 @@ impl std::fmt::Display for PatchInfo {
if !self.entities.is_empty() {
writeln!(f, "entities:")?;
for (entity_idx, entity) in self.entities.iter().enumerate() {
- if entity_idx >= LIST_DISPLAY_LIMIT {
- writeln!(f, "* ......")?;
- break;
- }
writeln!(f, "* {}", entity.patch_name.to_string_lossy())?;
}
}
@@ -96,18 +90,9 @@ impl std::fmt::Display for PatchInfo {
writeln!(f, "patches:")?;
let last_idx = self.patches.len() - 1;
for (patch_idx, patch_file) in self.patches.iter().enumerate() {
- if patch_idx != last_idx {
- if patch_idx >= LIST_DISPLAY_LIMIT {
- writeln!(f, "* ......")?;
- break;
- }
- writeln!(f, "* {}", patch_file.name.to_string_lossy())?
- } else {
- if patch_idx >= LIST_DISPLAY_LIMIT {
- write!(f, "* ......")?;
- break;
- }
- write!(f, "* {}", patch_file.name.to_string_lossy())?
+ match patch_idx == last_idx {
+ false => writeln!(f, "* {}", patch_file.name.to_string_lossy())?,
+ true => write!(f, "* {}", patch_file.name.to_string_lossy())?,
}
}
}
--
2.34.1