summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-09-27 12:09:22 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2019-09-27 12:16:13 +0200
commit4afb07258fad5f9026ad25f579a871093a312ac5 (patch)
treeb03344f7f38c527c0c4095b87ce7e766cc885396
parent534b12f4b47192bd20ea2147311bda58f92005e2 (diff)
downloadapt-4afb07258fad5f9026ad25f579a871093a312ac5.tar.gz
Parse 'show' arguments for the 'info' alias as well
We recently made info an alias for show, but we did not change the command-line parser to work around it. LP: #1843812
-rw-r--r--apt-private/private-cmndline.cc4
-rwxr-xr-xtest/integration/test-apt-cli-show76
2 files changed, 78 insertions, 2 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index 5944e530d..a78cbaf1a 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -59,7 +59,7 @@ static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char cons
addArg('n', "names-only", "APT::Cache::NamesOnly", 0);
addArg('f', "full", "APT::Cache::ShowFull", 0);
}
- else if (CmdMatches("show"))
+ else if (CmdMatches("show") | CmdMatches("info"))
{
addArg('a', "all-versions", "APT::Cache::AllVersions", 0);
}
@@ -344,7 +344,7 @@ static bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * c
addArg('v', "verbose", "APT::Cmd::List-Include-Summary", 0);
addArg('a', "all-versions", "APT::Cmd::All-Versions", 0);
}
- else if (CmdMatches("show"))
+ else if (CmdMatches("show") || CmdMatches("info"))
{
addArg('a', "all-versions", "APT::Cache::AllVersions", 0);
}
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
index a37dbd8e6..4f9e9a16c 100755
--- a/test/integration/test-apt-cli-show
+++ b/test/integration/test-apt-cli-show
@@ -20,6 +20,8 @@ insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR"
insertpackage 'unstable' 'big' 'i386,amd64' '1' 'Installed-Size: 4129421' '' "$DESCR"
insertpackage 'unstable' 'large' 'all' '1' "Provides: pkga$(generatelotsofnames)" '' "$DESCR"
insertpackage 'unstable' 'large2' 'all' '1' "Provides: foobar, pkga$(generatelotsofnames)" '' "$DESCR"
+insertpackage 'unstable' 'multi' 'all' '1.0' '' '' "$DESCR"
+insertpackage 'unstable' 'multi' 'all' '2.0' '' '' "$DESCR"
insertinstalledpackage 'foo' 'all' '1.0'
setupaptarchive
@@ -99,6 +101,80 @@ Description: Some description
That has multiple lines
" apt show large2
+# Test for multiple versions
+testsuccessequal "Package: multi
+Version: 2.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+
+N: There is 1 additional record. Please use the '-a' switch to see it" apt show multi
+
+testsuccessequal "Package: multi
+Version: 2.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+
+Package: multi
+Version: 1.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+" apt show multi -a
+
+# test apt info
+testsuccessequal "Package: multi
+Version: 2.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+
+N: There is 1 additional record. Please use the '-a' switch to see it" apt info multi
+
+testsuccessequal "Package: multi
+Version: 2.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+
+Package: multi
+Version: 1.0
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main all Packages
+Description: Some description
+ That has multiple lines
+" apt info multi -a
+
# this is the default, but disabled by the testcases
testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
cp rootdir/tmp/testsuccess.output aptshow.output