apt-cache给出了一行摘要:
$ apt-cache search conway
golly - Game of Life simulator using hashlife algorithm
libclass-delegator-perl - Perl module for a simple and fast object-oriented delegation
...但是,apt search没有:
$ apt search conway
Sorting... Done
Full Text Search... Done
golly/impish 3.3-1build1 amd64
Game of Life simulator using hashlife algorithm
libclass-delegator-perl/impish,impish 0.09-4.1 all
Perl module for a simple and fast object-oriented delegation
...有一个apt配置选项使它返回一行摘要,但我不知道它是什么。这个-o选项是什么,它在哪里文档化?
发布于 2022-01-18 06:03:04
您需要告诉apt使用自定义格式,并给它一个自定义格式:
$ apt -o apt::cmd::use-format=1 -o apt::cmd::format='${Package} - ${Description}' search conway
Sorting... Done
Full Text Search... Done
golly - Game of Life simulator using hashlife algorithm
libclass-delegator-perl - Perl module for a simple and fast object-oriented delegation
libmodule-starter-pbp-perl - Perl module to create new perl modules following best practices
libmoosex-followpbp-perl - Moose extension to name your accessors get_foo() and set_foo()
libperl-critic-perl - Perl module to critique code for best practices
libsub-wrappackages-perl - module to wrap subroutines in packages
libtemplate-plugin-lingua-en-inflect-perl - interface to Lingua::EN::Inflect for the Template Toolkit
sagemath-database-conway-polynomials - Database of Conway polynomials支持的格式“变量”没有文档化(在源代码中甚至有这样的注释);阅读这个apt来源显示它们如下所示:
${db::Status-Abbrev}:状态标志的摘要(B用于已损坏的包,g用于可升级的包,i用于已安装的软件包,-用于其他一切);${Package}:包名;${Architecture};封装体系结构;${installed:Version}:已安装的版本;${candidate:Version}:候选版本;${Version}:正在列出的版本;${Origin}:档案套件;${apt:Status}:状态字符串(“已安装”、“可升级”、“自动”等);${color:highlight}:高光的转义代码;${color:neutral}:转义码返回到“中性”颜色;${Description}:简短的描述;${LongDescription}:长篇描述。匹配apt-cache search‘S输出的格式字符串是${Package} - ${Description},而apt search的默认短格式字符串是${color:highlight}${Package}${color:neutral}/${Origin} ${Version} ${Architecture}${ }${apt:Status}\n ${Description}\n。
发布于 2022-01-17 22:10:32
我能得到的最接近的是以下内容:
$ apt search -o="apt::cmd::use-format=1" conway
Sorting... Done
Full Text Search... Done
- golly 3.3-1build1 focal Game of Life simulator using hashlife algorithm
- libclass-delegator-perl 0.09-4 focal,focal Perl module for a simple and fast object-oriented delegation
- libmodule-starter-pbp-perl 0.0.3-2 focal,focal Perl module to create new perl modules following best practices
- libmoosex-followpbp-perl 0.05-2 focal,focal Moose extension to name your accessors get_foo() and set_foo()
- libperl-critic-perl 1.138-1 focal,focal Perl module to critique code for best practices
- libsub-wrappackages-perl 2.01-1 focal,focal module to wrap subroutines in packages
- libtemplate-plugin-lingua-en-inflect-perl 0.04-1 focal,focal interface to Lingua::EN::Inflect for the Template Toolkit
- sagemath-database-conway-polynomials 0.5-7 focal,focal Database of Conway polynomials我在配置选项(Ubuntu20.04)中找到的文件是:
/usr/share/doc/apt/examples/configure-index有个选择
apt::cmd::format "";但是我不能让它起作用 (智能)并没有找到如何使用它的例子。也许有人可以从这里拿走它。
https://unix.stackexchange.com/questions/686765
复制相似问题