猿问

config.yml 中的 dlv 替换路径示例

在 $HOME/.dlv/config.yml 中设置从和到路径的任何示例?我试过设置:


案例 1(在 from 和 to 中加上引号)替代路径:


{"from":

"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"

"to": "/Users/xxx/code/src"}

案例 2:(在 from 和 to 中没有引号)替代路径:


{from:

"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"

to: "/Users/xxx/code/src"}

案例 2:(在 '{from' 之前有连字符)替换路径:


-{from:

"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"

to: "/Users/xxx/code/src"}

案例 2:(在 '{from' 之前有连字符)替换路径:


-{"from":

"/private/var/tmp/_bazel/d3eb9a0ef06857aebc54b41ff425d2ee"

"to": "/Users/xxx/code/src"}

所有 4 种情况都因配置而失败。错误。任何工作样本来设置路径?


holdtom
浏览 370回答 1
1回答

Smart猫小萌

我认为你缺少一个空间。仅当值或键中有空格或其他一些不可打印的非 ascii 字符时,引号才相关。这里的配置,没有注释:$ cat ~/.config/dlv/config.yml | sed '/^#/d; /^$/d'aliases:&nbsp; # command: ["alias1", "alias2"]substitute-path:&nbsp; - {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&nbsp;{&nbsp; "aliases": null,&nbsp; "substitute-path": [&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; "from": "/my/source/code/was/here",&nbsp; &nbsp; &nbsp; "to": "/but/now/its/here"&nbsp; &nbsp; }&nbsp; ],&nbsp; "debug-info-directories": [&nbsp; &nbsp; "/usr/lib/debug/.build-id"&nbsp; ]}yq 工具是 jq 的包装器。$ yq --help | sed 8qusage: yq [options] <jq filter> [input file...]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [jq_filter] [files [files ...]]yq: Command-line YAML processor - jq wrapper for YAML documentsyq transcodes YAML documents to JSON and passes them to jq.See https://github.com/kislyuk/yq for more information.
随时随地看视频慕课网APP

相关分类

Go
我要回答