tealdeer-rs / tealdeer

A very fast implementation of tldr in Rust.
https://tealdeer-rs.github.io/tealdeer/
Apache License 2.0
4.17k stars 123 forks source link

Support platform type "all" #229

Closed dbrgn closed 2 years ago

dbrgn commented 2 years ago

This is the third part of #209.

The goal is supporting the special all platform that results in pages for all platforms being listed when calling --list. It's part of the tldr client specification.

However, All should not be a variant of the PlatformType enum, because Current isn't a PlatformType either. Thus, we accept the string all but convert it into the current platform when parsing.

For consistency, the same is done when no platform is specified, by introducing yet another possible value current which is used by default. This way, we get rid of the Option.

Due to limitations in clap, we had to remove the requires = "command" requirement, however that's actually a good thing because --list does not require a command either, but supports the --platform parameter.

To simplify handling of os / platform arguments, a conflict between --platform and --os was introduced.

dbrgn commented 2 years ago

Discussion in https://github.com/tldr-pages/tldr/issues/7528 and https://github.com/tldr-pages/tldr/pull/7561 is still ongoing, but I'll remove this from the milestone: This definitely isn't one of the important compatibility issues we're having.

dbrgn commented 2 years ago

Closing for now.