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

uudoc, uucore_procs: move markdown parsing to HelpParser #4398

Merged

Conversation

cakebaker
Copy link
Contributor

This PR is related to #4393 (comment) and removes the check for the about section. It also removes the check for the long_about value because no tool sets this value.

src/bin/uudoc.rs Outdated
.get_long_about()
.or_else(|| self.command.get_about())
{
if let Some(about) = self.command.get_about() {
Copy link
Member

@tertsdiepraam tertsdiepraam Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep this coming from the markdown directly. That enables us to use markdown syntax.

(Currently only backticks, which are removed before we pass them to clap, but render as inline code blocks in the online docs. Full compile-time markdown support is one of the things I'm working on in supporting for the new argument parser.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this stub of a function:

fn render_markdown(s: &str) -> String {
s.replace('`', "")
}

Also I see we aren't using that function in about, so that's another thing I'll have to look into.

Copy link
Member

@tertsdiepraam tertsdiepraam Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could skip it for now if it's half-baked anyway. For context, it's all part of this issue #3181, but I got a bit sidetracked on the argument parsing :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, so the usage info should also come from the markdown instead of render_usage?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that one definitely, especially once your other PR for indentation gets merged: #4393. If it would come from render_usage we'd get additional indentation in the online docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is already a trim in the current implementation (https://github.com/uutils/coreutils/blob/main/src/bin/uudoc.rs#L179) and so #4393 doesn't affect the online docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, that one doesn't matter then

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?

@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch from d9ca2b5 to 574fdc9 Compare March 17, 2023 08:07
@cakebaker cakebaker changed the title uudoc: simplify generation of about text uudoc, uucore_procs: move markdown parsing to HelpParser Mar 17, 2023
@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch from 574fdc9 to cac0b0e Compare March 17, 2023 08:15
@cakebaker
Copy link
Contributor Author

I moved the markdown parsing from uucore_procs into its own crate, help_parser, and made uudoc use it, too. I'm not sure about the location of the crate, somehow it doesn't feel "right" ;-)

@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch 2 times, most recently from 22a4af6 to 0f5c37c Compare March 17, 2023 09:06
@cakebaker cakebaker requested a review from tertsdiepraam March 17, 2023 09:37
Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of putting this in a separate crate. I agree that the location doesn't feel quite right, but I can't think of a better one.

Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
src/help_parser/Cargo.toml Outdated Show resolved Hide resolved
src/help_parser/Cargo.toml Outdated Show resolved Hide resolved
src/help_parser/Cargo.toml Outdated Show resolved Hide resolved
src/help_parser/src/lib.rs Outdated Show resolved Hide resolved
@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch from 0f5c37c to 16cee00 Compare March 19, 2023 13:19
@cakebaker
Copy link
Contributor Author

Initially I tried to add it to uucore, but adding uucore as a dependency of uucore_procs didn't work.

@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch 2 times, most recently from dc5fb2a to 6265cf9 Compare March 23, 2023 08:49
@cakebaker
Copy link
Contributor Author

The most recent push resolves the merge conflict with #4569

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?

@sylvestre
Copy link
Contributor

sorry, it needs to be rebased :)

@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch from 6265cf9 to 9654b58 Compare April 3, 2023 11:37
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@sylvestre
Copy link
Contributor

@cakebaker ping ? :)

@cakebaker cakebaker force-pushed the uudoc_simplify_about_text_generation branch from 9654b58 to 6583231 Compare April 16, 2023 12:33
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail-2/inotify-dir-recreate is no longer failing!

@tertsdiepraam tertsdiepraam merged commit 19add3a into uutils:main Apr 20, 2023
@cakebaker cakebaker deleted the uudoc_simplify_about_text_generation branch April 20, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants