使用grep在composer.lock文件中查找包的特定版本号?
我想从我的使用grep在composer.lock文件中查找包的特定版本号?,grep,silverstripe,Grep,Silverstripe,我想从我的composer.lock文件中通过composer获取的包的版本号 我提取了包含版本号的对象,以便于在StackOverflow上查看。不过,composer还引入了多个其他包,当然它们都有自己的版本号。我需要输入silverstripe/framework的版本号,即3.5.3,如下所示 如何使用grep通过命令行执行此操作?如果有更好/更简单的方法,也可以使用其他解决方案 作曲家锁定 { "name": "silverstripe/framework",
composer.lock
文件中通过composer获取的包的版本号
我提取了包含版本号的对象,以便于在StackOverflow上查看。不过,composer还引入了多个其他包,当然它们都有自己的版本号。我需要输入silverstripe/framework
的版本号,即3.5.3
,如下所示
如何使用grep
通过命令行执行此操作?如果有更好/更简单的方法,也可以使用其他解决方案
作曲家锁定
{
"name": "silverstripe/framework",
"version": "3.5.3",
"source": {
"type": "git",
"url": "https://github.com/silverstripe/silverstripe-framework.git",
"reference": "a2580456bda9ff513cf80227039fc79405908f3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silverstripe/silverstripe-framework/zipball/a2580456bda9ff513cf80227039fc79405908f3f",
"reference": "a2580456bda9ff513cf80227039fc79405908f3f",
"shasum": ""
},
"require": {
"composer/installers": "~1.0",
"php": ">=5.3.3,<7"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
},
"type": "silverstripe-module",
"extra": {
"branch-alias": {
"3.x-dev": "3.5.x-dev"
}
},
"autoload": {
"classmap": [
"tests/behat/features/bootstrap"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "SilverStripe",
"homepage": "http://silverstripe.com"
},
{
"name": "The SilverStripe Community",
"homepage": "http://silverstripe.org"
}
],
"description": "The SilverStripe framework",
"homepage": "http://silverstripe.org",
"keywords": [
"framework",
"silverstripe"
],
"time": "2017-02-20 17:01:16"
},
{
“名称”:“silverstripe/framework”,
“版本”:“3.5.3”,
“来源”:{
“类型”:“git”,
“url”:”https://github.com/silverstripe/silverstripe-framework.git",
“参考文件”:“a2580456bda9ff513cf80227039fc79405908f3f”
},
“地区”:{
“类型”:“zip”,
“url”:”https://api.github.com/repos/silverstripe/silverstripe-framework/zipball/a2580456bda9ff513cf80227039fc79405908f3f",
“参考文件”:“a2580456bda9ff513cf80227039fc79405908f3f”,
“shasum”:”
},
“要求”:{
“编写者/安装者”:“~1.0”,
“php”:“>=5.3.3,是处理JSON数据的合适工具:
jq '.packages[] | select(.name == "silverstripe/framework").version' composer.lock
"3.5.3"
我不希望安装其他第三方工具。此外,通过composer安装的许多其他软件包将具有“版本”"那么,该命令不会吐出所有版本吗?@ifusion,您已经写下,您已经提取了包含版本号的对象。因此,使用jq
进行管道传输,这将是所需的版本啊,对不起,我的意思是,我提取该对象是为了在stackoverflow上显示,有多个其他包正在安装我也打了。对不起,我不太清楚,我将编辑我原来的问题。