Closed jgogstad closed 3 months ago
label as feature request obviously
I thought about this a bit and I think it is not feasible, since this hierarchy is not recognizable for us. The problem is that pages for subcommands like git add
are saved as git-add.md
, so we cannot easily distinguish between subcommands and commands that have a "-", for example xdg-open
Now, we could open the file and check which version is used in the examples, but that seems like a lot of effort for a very niche use case
yeah, analyzing file contents is not the way to go. I think just enforcing the naming standard make sense. That is, xdg-open.md
is a subcommand of xdg.md
. The logic would be "if the parent exists, print it as the parent, if children exists print the children. If none exists, don't print anything".
That means that if there is a case where there's a binary xdg
and a binary xdg-open
and they have nothing to do with one another, they will be incorrectly marked as a parent child relationship. That is awfully fringe though, I'm yet to be convinced that a case exists. Worst case you could add a flag to disable relationship printing 🤷♂️
I concur with @niklasmohrin. First of all, enforcing naming standards is not up to us, it's up to the tldr project. While this might be possible to implement using a set of heuristics and "does this binary exist" file system checks, that would make tealdeer both slower and harder to maintain (because the complexity is increased).
To see subpages, I recommend installing shell completions and pressing the tab key after tying the base command:
Several tldr pages have subpages that form a hierarchy of tldr pages for a single high level command. E.g. one can do
tldr git branch
to show the tldr page for thegit branch
subcommand. Show available subpages when viewing pages higher up in the hierarchy. For instance