ipfs / ipfs/kubo

helptext for all commands

Open
#2,647 6 comments 0 reactions 0 assignees View on GitHub
exp/novice help wanted topic/docs-ipfs
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

I would love to add a test like this to the codebase:

``` go
package commands

import (
cmds "github.com/ipfs/go-ipfs/commands"
"strings"
"testing"
)

func checkHelptextRecursive(t *testing.T, name []string, c *cmds.Command) {
if c.Helptext.Tagline == "" {
t.Fatalf("%s has no tagline!", strings.Join(name, " "))
}

if c.Helptext.LongDescription == "" {
t.Fatalf("%s has no long description!", strings.Join(name, " "))
}

if c.Helptext.ShortDescription == "" {
t.Fatalf("%s has no short description!", strings.Join(name, " "))
}

if c.Helptext.Synopsis == "" {
t.Fatalf("%s has no synopsis!", strings.Join(name, " "))
}

for subname, sub := range c.Subcommands {
checkHelptextRecursive(t, append(name, subname), sub)
}
}

func TestHelptexts(t *testing.T) {
checkHelptextRecursive(t, []string{"ipfs"}, Root)
}
```

But right now it would just fail, lots of commands are missing various pieces of the helptext. Enforcing this would make our docs muuuuuch better i think. We would also be able to generate manpages easily from them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.