Skip to content

Conversation

ItamarShalev
Copy link
Contributor

Add support for the TLDR_PLATFORM environment variable to let users specify the desired platform (e.g., "linux", "macos", "windows") for fetching TLDR pages.
This overrides the default platform detection.
The --platform option remains supported for per-command overrides.

@ItamarShalev
Copy link
Contributor Author

ItamarShalev commented Jun 30, 2025

@kbdharun
@Managor

I'm not sure who can review these patches.
I would like to get a review if you can do it :)

Also for this patch:
#291

@Managor
Copy link
Member

Managor commented Jun 30, 2025

Be patient. People will review them when they have time.

@ItamarShalev
Copy link
Contributor Author

Be patient. People will review them when they have time.

Thanks !
no problem, I used to see popup of the reviewers, so I wondered if you still open for patches.

README.md Outdated
Comment on lines 101 to 109
- `linux`
- `windows`
- `win32`
- `android`
- `darwin`
- `freebsd`
- `macos`
- `netbsd`
- `openbsd`
- `osx`
- `sunos`

Copy link
Member

Choose a reason for hiding this comment

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

I believe some of these don't exist.

Itamar Shalev added 2 commits June 30, 2025 21:17
Add support for the TLDR_PLATFORM environment variable to let users
specify the desired platform (e.g., "linux", "macos", "windows") for
fetching TLDR pages.
This overrides the default platform detection.
The --platform option remains supported for per-command overrides.

Signed-off-by: Itamar Shalev <[email protected]>
tldr.py Outdated
@@ -59,6 +59,8 @@
"windows": "windows"
}

SUPPORTED_PLATFORMS = sorted(set(OS_DIRECTORIES.values()))
Copy link
Member

@owenvoke owenvoke Jul 1, 2025

Choose a reason for hiding this comment

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

I think this should be using the keys (the platform name), as the values are the actual directories. 👀 Otherwise you won't be able to specify darwin, or win32 👍🏻

Suggested change
SUPPORTED_PLATFORMS = sorted(set(OS_DIRECTORIES.values()))
SUPPORTED_PLATFORMS = sorted(set(OS_DIRECTORIES.keys()))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the idea
As I asked here: #292 (comment)
I have no problem to allow the symlinks

Copy link
Member

@owenvoke owenvoke Jul 1, 2025

Choose a reason for hiding this comment

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

Although they don't actually exist in tldr and aren't symlinks, I think it makes sense to support the aliases to be honest as that's the already supported values for --platform on this client (and the Node client).

Or, I guess we can keep it as-is with .values() to stay in-line with --platform on the C client.

I will leave this for someone with more experience in client dev to decide. 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can support it but don't specify this option in the readme.md, agreed ?

Copy link
Member

Choose a reason for hiding this comment

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

We can probably just say to look at the --platform flag for available platforms, rather than repeating them.

@kbdharun kbdharun self-requested a review July 1, 2025 18:19
Copy link
Member

@kbdharun kbdharun left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for your contribution.


Edit. Added coloring to the warning message too (via colored for all platforms and colorama for Windows Legacy Command Prompt).

image image

@kbdharun kbdharun changed the title tldr: env: Add TLDR_PLATFORM env var to override platform detection feat: add TLDR_PLATFORM env variable to override platform detection Sep 4, 2025
@kbdharun kbdharun merged commit e2c4068 into tldr-pages:main Sep 4, 2025
27 checks passed
@Managor
Copy link
Member

Managor commented Sep 15, 2025

This PR caused #306

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.

6 participants