coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

DRAFT: poc-manpages

Open Its-Just-Nans opened this issue 1 year ago • 1 comments

A full automatic build of manpage and completion on build.rs

inspired by https://github.com/bootandy/dust/blob/master/build.rs

Related to: https://github.com/uutils/coreutils/issues/4464

To test, remember to mkdir completion

Its-Just-Nans avatar Jun 30 '24 22:06 Its-Just-Nans

At the moment the poc is working for a static utility (example here with arch)

Don't really know for now how to add the dynamic call of all uu_app()

src/args.rs is working but not clean

Looking for feedbacks or suggestions

Its-Just-Nans avatar Jun 30 '24 22:06 Its-Just-Nans

Explanation on how it's working:

  • each utils have a uu_args.rs file
  • these uu_args.rs are standalone and are included in src/args.rs
  • in the build.rs, we collect all uu_args.rs and call uu_app() to access a clap::Command
  • we generate completionS and man pages for each of them

Note: for now commit name are not great, when the PR is finished I will squash everything

Its-Just-Nans avatar Jul 05 '24 10:07 Its-Just-Nans

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Jul 05 '24 10:07 github-actions[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Jul 07 '24 11:07 github-actions[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Jul 07 '24 17:07 github-actions[bot]

This is a huge patch that requires discussions.

Note that we already have completion: cargo run completion <utility> <shell>

and manpage generation: cargo run manpage <utility>

sylvestre avatar Jul 07 '24 21:07 sylvestre

This is a huge patch that requires discussions.

Note that we already have completion: cargo run completion <utility> <shell>

and manpage generation: cargo run manpage <utility>

Yes, I saw that!

With this PR:

  • Everything is generated automatically with build.rs.
  • It also represents a general improvement of the code. For example, all CLI options are now in a module usable with options::OPTION_NAME (some utilities were still using OPTION_NAME), and all utilities follow the same pattern.
  • We could technically get rid of the UtilityMap generation because we know everything at compile time.

What should be done

  • ~~I currently don't really understand why test were passing for chgrp and chown ??! (I undestant that perms is gated behing a feature, be that was also the case before ?!)~~
  • vdir and dir are not currently done, because they depend on uu_ls -> to fix that the simplest solution is to move uu_ls::uu_app into uu_core (which already is the case for chown and baseXX utils)
  • fix the cspell (quite simple)

Its-Just-Nans avatar Jul 07 '24 21:07 Its-Just-Nans

I am really sorry but you should not spend more time on it before discussing with the maintainers.

A few points:

  • You are doing way too many different things in the same PR.
  • The refactor of " all CLI options are now in a module usable with options::OPTION_NAME" should be done a specific PR with prior discussions. We have downstream users of the coreutils like nushell and this will probably impact them.
  • "Everything is generated automatically with build.rs", why is it a pro compared to the previous way?
  • Why adding all these files in the repo ?

sylvestre avatar Jul 08 '24 11:07 sylvestre

Much better already, thanks!

tertsdiepraam avatar Jul 08 '24 17:07 tertsdiepraam

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Jul 08 '24 17:07 github-actions[bot]

I'm closing it reading the comment from @tertsdiepraam this PR is introducing to much changes and they are not great

thanks for reviewing it

Its-Just-Nans avatar Aug 13 '24 21:08 Its-Just-Nans