mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 00:39:31 +08:00
Add default true options handling
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -234,10 +234,20 @@ func generateSynopsis(cmd *cmds.Command, path string) string {
|
||||
if len(n) > 1 {
|
||||
pre = "--"
|
||||
}
|
||||
if i == 0 {
|
||||
sopt = fmt.Sprintf("%s%s=<%s>", pre, n, valopt)
|
||||
if opt.Type() == cmds.Bool && opt.DefaultVal() == true {
|
||||
pre = "--"
|
||||
sopt = fmt.Sprintf("%s%s=false", pre, n)
|
||||
break
|
||||
} else {
|
||||
sopt = fmt.Sprintf("%s | %s%s", sopt, pre, n)
|
||||
if i == 0 {
|
||||
if opt.Type() == cmds.Bool {
|
||||
sopt = fmt.Sprintf("%s%s", pre, n)
|
||||
} else {
|
||||
sopt = fmt.Sprintf("%s%s=<%s>", pre, n, valopt)
|
||||
}
|
||||
} else {
|
||||
sopt = fmt.Sprintf("%s | %s%s", sopt, pre, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
res = fmt.Sprintf("%s [%s]", res, sopt)
|
||||
|
Reference in New Issue
Block a user