[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Columnar package list style (patch included)



On Wed, Mar 02, 2016 at 11:56:09PM +0100, Christian Blichmann wrote:
> Hey Super Cow Power team,
> 
> While browsing through the package list of a recent "apt-get dist-upgrade" I
> thought that it'd be useful to show the list of packages in columnar format,
> just like the traditional "ls" command.
> 
> Would anyone be interested in this feature?

Maybe. I personally don't need it, I use verbose-versions to get one name per line :)

But anyway, some comments below.

> 
> Since I have no idea how to send a proper apt-style "pull request", I have
> attached a patch that implements it (should apply cleanly to master). 

Thanks for your patch.

> Do tell me how to do it properly or push me in the right direction :)

A patch formatted with git format-patch is a great idea.

Comments:

> diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
> index 8290859..406f9ba 100644
> --- a/apt-private/private-cmndline.cc
> +++ b/apt-private/private-cmndline.cc
> @@ -173,7 +173,8 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
>        addArg(0, "show-progress", "DpkgPM::Progress", 0);
>        addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0);
>        addArg(0, "purge", "APT::Get::Purge", 0);
> -      addArg('V',"verbose-versions","APT::Get::Show-Versions",0);
> +      addArg('V', "verbose-versions", "APT::Get::Show-Versions", 0);
> +      addArg(0, "list-columns", "APT::Get::Show-Columns", 0);

list or show columns?

>        addArg(0, "auto-remove", "APT::Get::AutomaticRemove", 0);
>        addArg(0, "reinstall", "APT::Get::ReInstall", 0);
>        addArg(0, "solver", "APT::Solver", CommandLine::HasArg);

> diff --git a/apt-private/private-output.h b/apt-private/private-output.h
> index 8e4b50e..d99e2af 100644
> --- a/apt-private/private-output.h
> +++ b/apt-private/private-output.h
> @@ -9,6 +9,7 @@
>  #include <fstream>
>  #include <string>
>  #include <iostream>
> +#include <vector>
>  
>  // forward declaration
>  class pkgCacheFile;
> @@ -34,6 +35,8 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,
>  APT_PUBLIC void ShowBroken(std::ostream &out, CacheFile &Cache, bool const Now);
>  APT_PUBLIC void ShowBroken(std::ostream &out, pkgCacheFile &Cache, bool const Now);
>  
> +void ShowColumnarList(std::ostream &out, const std::vector<std::string> &List, size_t Indent, size_t ScreenWidth);

Don't like columnar, but don't know why.

> +
>  template<class Container, class PredicateC, class DisplayP, class DisplayV> bool ShowList(std::ostream &out, std::string const &Title,
>        Container const &cont,
>        PredicateC Predicate,
> @@ -43,7 +46,9 @@ template<class Container, class PredicateC, class DisplayP, class DisplayV> bool
>     size_t const ScreenWidth = (::ScreenWidth > 3) ? ::ScreenWidth - 3 : 0;
>     int ScreenUsed = 0;
>     bool const ShowVersions = _config->FindB("APT::Get::Show-Versions", false);
> +   bool const ShowColumnar = _config->FindB("APT::Get::Show-Columns", false);

columnar or columns?


> diff --git a/debian/changelog b/debian/changelog
> index 6aabe9e..e295155 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,9 @@
> +apt (1.2.5) unstable; urgency=medium
> +
> +  * Add columnar output for package lists in the style of 'ls'
> +
> + -- Christian Blichmann <mail@blichmann.eu>  Tue, 01 Mar 2016 22:59:29 +0100

No changelog entries, we autogenerate them from git commit messages.


-- 
Debian Developer - deb.li/jak | jak-linux.org - free software dev

When replying, only quote what is necessary, and write each reply
directly below the part(s) it pertains to (`inline'). Thank you.


Reply to: