英文:
dlv substitute-path example in config.yml
问题
在$HOME/.dlv/config.yml中设置from和to路径的示例是什么?我尝试了以下设置:
情况1(在from和to中使用引号)
substitute-path:
{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}
情况2(在from和to中不使用引号)
substitute-path:
{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}
情况3(在'from'之前使用连字符)
substitute-path:
-{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}
情况4(在'from'之前使用连字符)
substitute-path:
-{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}
这4种情况都会导致配置错误。有没有设置路径的有效示例?
英文:
Any example to set from and to path in $HOME/.dlv/config.yml ? I have tried setting:
case 1 ( with quotes in from and to)
substitute-path:
{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}
case 2: ( without quotes in from and to)
substitute-path:
{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}
case 2: ( with hyphan before '{from' )
substitute-path:
-{from:
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
to: "/Users/xxx/code/src"}
case 2: ( with hyphan before '{from' )
substitute-path:
-{"from":
"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"
"to": "/Users/xxx/code/src"}
all 4 cases fails with config. error.
any working sample to set the path?
答案1
得分: 0
我认为你漏掉了一个空格。引号只在值或键中包含空格或其他不可打印的非ASCII字符时才相关。
这是没有注释的配置:
$ cat ~/.config/dlv/config.yml | sed '/^#/d; /^$/d'
aliases:
# command: ["alias1", "alias2"]
substitute-path:
- {from: /my/source/code/was/here, to: /but/now/its/here}
debug-info-directories: ["/usr/lib/debug/.build-id"]
看起来是有效的YAML:
$ yq < ~/.config/dlv/config.yml
{
"aliases": null,
"substitute-path": [
{
"from": "/my/source/code/was/here",
"to": "/but/now/its/here"
}
],
"debug-info-directories": [
"/usr/lib/debug/.build-id"
]
}
yq工具是jq的包装器:
$ yq --help | sed 8q
usage: yq [options] <jq filter> [input file...]
[jq_filter] [files [files ...]]
yq: Command-line YAML processor - jq wrapper for YAML documents
yq transcodes YAML documents to JSON and passes them to jq.
See https://github.com/kislyuk/yq for more information.
英文:
I think you are missing a space. The quotes are relevant only if the values or keys have spaces in them, or some other non-printable, non-ascii characters.
The config here, without comments:
$ cat ~/.config/dlv/config.yml | sed '/^#/d; /^$/d'
aliases:
# command: ["alias1", "alias2"]
substitute-path:
- {from: /my/source/code/was/here, to: /but/now/its/here}
debug-info-directories: ["/usr/lib/debug/.build-id"]
Seems like valid yaml:
$ yq < ~/.config/dlv/config.yml
{
"aliases": null,
"substitute-path": [
{
"from": "/my/source/code/was/here",
"to": "/but/now/its/here"
}
],
"debug-info-directories": [
"/usr/lib/debug/.build-id"
]
}
The yq tool is a wrapper for jq.
$ yq --help | sed 8q
usage: yq [options] <jq filter> [input file...]
[jq_filter] [files [files ...]]
yq: Command-line YAML processor - jq wrapper for YAML documents
yq transcodes YAML documents to JSON and passes them to jq.
See https://github.com/kislyuk/yq for more information.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论