Repository navigation
Adding Help Text To Commands - #568
WillHipschman wants to merge 4 commits into
Conversation
1. Adds a generator declaration to convert .ronn documentation files into strings in help-text.go.
Each time a .ronn file is changed the help text to should be re-generated by running 'go generate'
before being built.
2. Adds a long description to each command to allow Cobra to pick up help text.
There was a problem hiding this comment.
Go doesn't really have a way to reflect over variables on a class, so I settled for a static map. If anyone has better ideas on how to map the man file names to variable names I'm all ears.
There was a problem hiding this comment.
This could just be generated along with the rest of the data. It wouldn't really bother me if it lived at the bottom of help-text.go. I think it's too easy to miss adding something to this list. What it's really testing is that the generator has run before building, and if something is missed then the test doesn't have much value.
|
It looks like a couple |
There was a problem hiding this comment.
I think this should go along with the other stuff under script/. That's our general convention so far, and things under docs/ do not get run through the formatter, which can lead to formatting and tab issues on different machines. There are several lines that don't have correct tabbing and there should be a space after import.
|
The |
There was a problem hiding this comment.
Go keywords tend to be in camelCase. Also, I think the git_lfs prefix here is redundant. I think you could name these after the subcommand: checkoutHelp, cleanHelp, etc.
There was a problem hiding this comment.
👍, and along with this, I think i'd rather see _ in the file names than -.
|
Higher level feedback: How does everyone feel about it displaying raw markdown to the terminal? I don't ❤️ it, but if it doesn't bother anyone else then I won't oppose it. I wouldn't want to pull in a markdown parser and display it formatted or anything, just maybe strip the markdown out. I'm also thinking that this approach differs a little from When you do The caveat to that is it only works if the Git LFS man pages have been installed, but |
Markdown is designed to look good in plain text, unless you're doing some weird stuff like extra html tags or tables. So I'm ok with it. But there are some tags, like I think I'd prefer git ignoring
I like this idea, actually. The markdown ronn files are converted to proper man pages, which git already knows how to display. It'd also keep us from storing the help text twice (in ronn files, and again in the go code). Now, since we don't have a reliable way to install man pages cross platform yet, I think this PR is a good workaround. I think the Also, do we even need these var help = map[string]string {
"checkout": `git-lfs-checkout(1) -- Update working copy with file content if available............`,
"clean": "...........",It's still very easy to set this to the |
|
First: I love that this is on the radar to fix. 👍
Just incase it hasn't come up yet, were you aware that the default behaviour in Windows for something like |
Currently using git lfs help checkout will not display anything other than the base help text of the Cobra command.
This change parses the .ronn man files in /docs/ and writes them to go variables as part of script/bootstrap using go generators. When making a man change (adding a new command/man file or modifying a current one) the help text can be regenerated by running 'go generate' from the git-lfs root or by running the bootstrap script.