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

Treat msys2 bash shell as Linux by default #377

Closed
comiluv opened this issue Sep 26, 2024 · 3 comments
Closed

Treat msys2 bash shell as Linux by default #377

comiluv opened this issue Sep 26, 2024 · 3 comments

Comments

@comiluv
Copy link

comiluv commented Sep 26, 2024

With msys2 installed on Windows 11, ran from Msys2 bash shell, tealdeer thinks the platform is Windows, but the platform should be treated as linux.
For example, Get-Childitem doesn't work on msys2 bash but tealdeer shows tldr-page entry for Get-Childitem Powershell cmdlet.
On the otherhand, pacman is the package manager for msys2 but tealdeer doesn't show its tldr-page entry on tldr pacman

$ Get-Childitem
bash: Get-Childitem: command not found
$ tldr Get-Childitem

  List items in a directory.
  Note: This command can only be used through PowerShell.
  More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-childitem>.

  List all non-hidden items in the current directory:

      Get-ChildItem

  List only directories in the current directory:

      Get-ChildItem -Directory

  List only files in the current directory:

      Get-ChildItem -File

  List items in the current directory, including hidden items:

      Get-ChildItem -Hidden

  List items in a directory other than the current one:

      Get-ChildItem -Path path\to\directory
$ pacman
error: no operation specified (use -h for help)
$ tldr pacman
Warning: Page `pacman` not found in cache.
Try updating with `tldr --update`, or submit a pull request to:
https://github.com/tldr-pages/tldr

Edit: also applicable to Git Bash on Windows o/s

@niklasmohrin
Copy link
Collaborator

The way it currently works is that we look at the --platform argument and as a fallback the platform that tealdeer was compiled to. Hence, tldr --platform linux pacman shows the expected page (it checks linux, then windows) and tldr pacman does not (it only checks windows).

I think that having windows as the default platform in Git Bash is still correct. I suppose that you don't want to always type -p linux. We don't have an option for "platform" in our configuration file right now, but it seems like a good idea to add one. Until then, I suppose you can create a shell alias so that tldr expands to tldr -p linux.

There is also a PR that changes the lookup rules so that all platforms are checked, which would also solve your problem. It has been stale for a while though.

@niklasmohrin niklasmohrin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
@niklasmohrin
Copy link
Collaborator

See #378

@comiluv
Copy link
Author

comiluv commented Sep 30, 2024

If anyone is wondering how I solved my situation, I simply added

alias tldr='tldr --platform linux '

in my .bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants