我正在尝试在bash中生成一个json文件.我安装了jq,希望它能帮助我生成和附加json.
例如,我想以这种格式生成一个json:
{
"Project": [
{
"projectName": {
"branch": [
{
"branchName": [
"path"
]
}
],
"tag": [
{
"tagName": [
"path"
]
}
]
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
虽然可以像这样,使用以下过滤器
.Project=.Project+.Project+
[{"projectName" : {"branch" : (.branch+[{"branchName":(.tagName+["path"])}]),
"tag": (.tag+[{"tagName":(.tagName+["path"])}]) }}]
Run Code Online (Sandbox Code Playgroud)
当我想在同一个项目和名称中创建另一个条目时,它会创建一个全新的条目,如果它是一个新项目,则会产生以下结果:
{
"Project": [
{
"projectName": {
"branch": [
{
"branchName": [
"path"
]
}
],
"tag": [
{
"tagName": [
"path"
]
}
]
}
},
{
"projectName": {
"branch": [
{
"branchName": [
"path"
]
}
],
"tag": …Run Code Online (Sandbox Code Playgroud) 我正在寻找包装完成后执行代码的方法。
我尝试添加一个取决于生成的PACKAGE目标的自定义目标。看起来不起作用,这是cmake错误:
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"ALL_BUILD" of type UTILITY
depends on "UPLOAD" (strong)
"PACKAGE" of type GLOBAL_TARGET
depends on "ALL_BUILD" (strong)
"UPLOAD" of type UTILITY
depends on "PACKAGE" (strong)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
Run Code Online (Sandbox Code Playgroud)
为此,我习惯于以下代码:
add_custom_target(UPLOAD ALL
COMMAND cmake -E echo "Should be post packging!"
)
add_dependencies(UPLOAD PACKAGE)
Run Code Online (Sandbox Code Playgroud)
有什么办法可以让目标上传已打包的文件?