Просмотр исходного кода

hide more from apt show

Hide the Hashes,Filename,Multi-Arch,Architecture by default from
"apt show". The information is still available via apt-cache show.

Also improve the output of the Size-
Michael Vogt лет назад: 12
Родитель
Сommit
17622532ce
2 измененных файлов с 15 добавлено и 8 удалено
  1. 12 3
      apt-private/private-show.cc
  2. 3 5
      test/integration/test-apt-cli-show

+ 12 - 3
apt-private/private-show.cc

@@ -76,12 +76,12 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
    // make size nice
    // make size nice
    std::string installed_size;
    std::string installed_size;
    if (Tags.FindI("Installed-Size") > 0)
    if (Tags.FindI("Installed-Size") > 0)
-      installed_size = SizeToStr(Tags.FindI("Installed-Size")*1024);
+      strprintf(installed_size, "%sB", SizeToStr(Tags.FindI("Installed-Size")*1024).c_str());
    else
    else
       installed_size = _("unknown");
       installed_size = _("unknown");
    std::string package_size;
    std::string package_size;
    if (Tags.FindI("Size") > 0)
    if (Tags.FindI("Size") > 0)
-      package_size = SizeToStr(Tags.FindI("Size"));
+      strprintf(package_size, "%sB", SizeToStr(Tags.FindI("Size")).c_str());
    else
    else
       package_size = _("unknown");
       package_size = _("unknown");
 
 
@@ -92,9 +92,18 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
       manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
       manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
    else
    else
       manual_installed = 0;
       manual_installed = 0;
+
+   // FIXME: add verbose that does not do the removal of the tags?
    TFRewriteData RW[] = {
    TFRewriteData RW[] = {
-      // delete
+      // delete, apt-cache show has this info and most users do not care
+      {"MD5sum", 0},
+      {"SHA1", 0},
+      {"SHA256", 0},
+      {"Filename", 0},
+      {"Multi-Arch", 0},
+      {"Architecture", 0},
       {"Conffiles",0},
       {"Conffiles",0},
+      // we use the translated description
       {"Description",0},
       {"Description",0},
       {"Description-md5",0},
       {"Description-md5",0},
       // improve
       // improve

+ 3 - 5
test/integration/test-apt-cli-show

@@ -21,14 +21,12 @@ APTARCHIVE=$(readlink -f ./aptarchive)
 testequal "Package: foo
 testequal "Package: foo
 Priority: optional
 Priority: optional
 Section: other
 Section: other
-Installed-Size: 43.0 k
+Installed-Size: 43.0 kB
 Maintainer: Joe Sixpack <joe@example.org>
 Maintainer: Joe Sixpack <joe@example.org>
-Architecture: all
 Version: 1.0
 Version: 1.0
-Filename: pool/main/foo/foo_1.0_all.deb
 Download-Size: unknown
 Download-Size: unknown
-Archive-Origin: unstable,now
-Manual-Installed: yes
+APT-Manual-Installed: yes
+APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages
 Description: Some description 
 Description: Some description 
  That has multiple lines
  That has multiple lines
 " apt show foo
 " apt show foo