有没有办法从https://repo.packagist.org筛选出信息?

发布于 2025-02-07 11:27:03 字数 316 浏览 1 评论 0 原文

作曲家有时会或多或少地提供有用/相关/兴趣ig“ infor” https://repo.packagist.org :... ”。

有没有办法不显示此消息?

也许是通过自定义外壳命令将其路由并滤除某些字符串的方法?

Composer sometimes deliveres more or less usefull/relevant/interestig "Info from https://repo.packagist.org: ...".

Is there a way to not show this message?

Maybe a way to route it through a custom shell command and filter out certain strings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乙白 2025-02-14 11:27:03

有没有办法不显示此消息?

简短的答案是 -Q - QUIES 命令行选项。它也抑制了其他输出。退出状态被保留。

也许是通过自定义外壳命令将其路由并滤除某些字符串的方法?

您尚未分享哪个外壳,但这肯定是可能的。在您的系统上给出 unnuffer(1) bash(1) a as /bin/bash ,您可以拥有一个可执行文件命名 COMPOSER PATH 的早期内,已安装的 Copser(1)在运行 Composer(1) > unnupler(1) ed。

由于这取决于您的外壳配置,因此可以更好地使用名为 install.sh 的文件来回答,该

# usage: . ./install.sh

utility_name=composer
utility_path_name="$(which "$utility_name")"
wrapper_path="$PWD"

if [ "$wrapper_path/$utility_name" = "$utility_path_name" ]; then
  echo "$utility_name: already installed: $utility_path_name" >&2
  return 1
fi

<< STUB tee "$utility_name"
#!/bin/bash
COMPOSER="$utility_path_name"
unbuffer "\$COMPOSER" "\$@" > >(sed -u '/^.*Info from https:\/\/repo\.packagist\.org:/d' )
STUB

chmod u+x -- "$utility_name"

PATH="$wrapper_path:$PATH"

which "$utility_name"

composer --version

文件之后可以采购:要激活包装器,请源:

$ . ./install.sh

然后,您可以使用此减少噪声过滤器运行每个 COMPOSER ... 命令。

实际包装器相对较薄(采购后输出您的 install.sh 以进行比较,因为路径不同):

$ cat composer
#!/bin/bash
COMPOSER="/home/user/.local/bin/composer"
unbuffer "$COMPOSER" "$@" > >(sed -u '/^.*Info from https:\/\/repo\.packagist\.org:/d' )

原则上,这与 Composer 本身独立,只有一个带有<<的输出过滤器代码> sed(1)并包装命令行实用程序。


在CI中,您可能需要做不同的事情,例如隐藏所有输出直到发生错误。 慢性(1)可以做到这一点。

Is there a way to not show this message?

The short answer is the -q, --quiet command-line option. It suppresses other output, too. Exit status is preserved.

Maybe a way to route it through a custom shell command and filter out certain strings?

You have not shared which shell, but this is certainly possible. Given on your system there is unbuffer(1) and bash(1) as /bin/bash, you could have an executable named composer within earlier in the PATH than the installed composer(1) one that filters that line out while running composer(1) unbuffer(1)ed.

As this depends on your shell configuration it is perhaps better answered with a file named install.sh that can be sourced afterwards:

# usage: . ./install.sh

utility_name=composer
utility_path_name="$(which "$utility_name")"
wrapper_path="$PWD"

if [ "$wrapper_path/$utility_name" = "$utility_path_name" ]; then
  echo "$utility_name: already installed: $utility_path_name" >&2
  return 1
fi

<< STUB tee "$utility_name"
#!/bin/bash
COMPOSER="$utility_path_name"
unbuffer "\$COMPOSER" "\$@" > >(sed -u '/^.*Info from https:\/\/repo\.packagist\.org:/d' )
STUB

chmod u+x -- "$utility_name"

PATH="$wrapper_path:$PATH"

which "$utility_name"

composer --version

To activate the wrapper, source the install.sh file:

$ . ./install.sh

You can then run every composer ... command with this noise reduction filter.

The actual wrapper is relatively thin (output yours after sourcing install.sh for comparison as paths differ):

$ cat composer
#!/bin/bash
COMPOSER="/home/user/.local/bin/composer"
unbuffer "$COMPOSER" "$@" > >(sed -u '/^.*Info from https:\/\/repo\.packagist\.org:/d' )

In principle this is independent to composer itself, just an output filter with sed(1) and wrapping a command-line utility.


Within CI you may want to do things differently, e.g. hiding all output until an error occurs. chronic(1) can do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文