Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Compile the docs into the jj binary #1294

Open
ilyagr opened this issue Feb 20, 2023 · 3 comments · May be fixed by #3130
Open

FR: Compile the docs into the jj binary #1294

ilyagr opened this issue Feb 20, 2023 · 3 comments · May be fixed by #3130
Labels
enhancement New feature or request

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Feb 20, 2023

I think it would be nice for jj to be self-documenting. A relatively simple approach would be to create a jj doc command so that jj doc tutorial prints docs/tutorial.md via a pager, using the include_str! macro. jj doc or jj doc list would list the available topics. I'm hoping that clap will provide tab completion (though this is optional, especially for the first version).

For example, I expect jj doc revsets to be useful.

Alternatively, this could be part of the jj help command, but I couldn't figure out an easy way to do that with clap. Also, the output of jj help is already quite long.

This will also match the version of the documentation people see with the version of jj they use.

@ilyagr ilyagr added the enhancement New feature or request label Feb 20, 2023
@dbarnett
Copy link
Contributor

I'd definitely start with making jj help more useful and self-contained. At least reference relevant docs from help.

Maybe could have some kind of jj help --topic FOO command (along the lines of hg's hg help FOO vs hg help --command FOO)?

@martinvonz
Copy link
Member

I'd definitely start with making jj help more useful and self-contained. At least reference relevant docs from help.

Patches for that would be appreciated. I don't notice it much myself.

Maybe could have some kind of jj help --topic FOO command (along the lines of hg's hg help FOO vs hg help --command FOO)?

There actually used to be a command for that. I decided that it was less maintenance work to keep it in separate markdown files. There's probably a way of generating something that's readable in terminal from the markdown files. I think I looked into that a little bit a year or so.

@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 20, 2023

Maybe could have some kind of jj help --topic FOO command

I am a little apprehensive about touching jj help since it's auto-generated by clap and I don't want to replace it entirely. If I can, I'd add a paragraph advertising the new jj doc command to jj help -- I think clap supports that much customization.

There's probably a way of generating something that's readable in terminal from the markdown files

At least at first, I was thinking of just sending them to the pager. There are also plenty of tools that try to render markdown more nicely in the terminal, we could later try finding a library that can be used from rust.

Some notes on that:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants