commands: replace <default> keyword with <<default>>

This way if we use <default> in description (we use thigns like <hash>
already), it won't conflict and modify the description in unwanted way.

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 45942332
...@@ -47,8 +47,8 @@ func (o *option) Description() string { ...@@ -47,8 +47,8 @@ func (o *option) Description() string {
o.description += "." o.description += "."
} }
if o.defaultVal != nil { if o.defaultVal != nil {
if strings.Contains(o.description, "<default>") { if strings.Contains(o.description, "<<default>>") {
return strings.Replace(o.description, "<default>", return strings.Replace(o.description, "<<default>>",
fmt.Sprintf("Default: %v.", o.defaultVal), -1) fmt.Sprintf("Default: %v.", o.defaultVal), -1)
} else { } else {
return fmt.Sprintf("%s Default: %v.", o.description, o.defaultVal) return fmt.Sprintf("%s Default: %v.", o.description, o.defaultVal)
......
...@@ -52,7 +52,7 @@ Publish an <ipfs-path> to another public key (not implemented): ...@@ -52,7 +52,7 @@ Publish an <ipfs-path> to another public key (not implemented):
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("resolve", "Resolve given path before publishing.").Default(true), cmds.BoolOption("resolve", "Resolve given path before publishing.").Default(true),
cmds.StringOption("lifetime", "t", cmds.StringOption("lifetime", "t",
`Time duration that the record will be valid for. <default> `Time duration that the record will be valid for. <<default>>
This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
"ns", "us" (or "µs"), "ms", "s", "m", "h".`).Default("24h"), "ns", "us" (or "µs"), "ms", "s", "m", "h".`).Default("24h"),
cmds.StringOption("ttl", "Time duration this record should be cached for (caution: experimental)."), cmds.StringOption("ttl", "Time duration this record should be cached for (caution: experimental)."),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论