sol / doctest

An implementation of Python's doctest for Haskell
https://hackage.haskell.org/package/doctest
MIT License
373 stars 73 forks source link

README: Use `cabal path --installdir` to augment `PATH` #431

Closed sol closed 4 months ago

sol commented 4 months ago

@mpilgrem I don't know how to do that Windows. Can you help with that?

mpilgrem commented 4 months ago

@sol, yes, by reference to this guidance. As a Windows user, I would reference the following two options and in this order:

Do you need to warn your README.md readers that cabal path requires Cabal (the tool) version 3.12.1.0 or greater - particularly as the GHCup project does not yet recommend version 3.12.1.0?

sol commented 4 months ago

Thanks @mpilgrem.

  • Use the Windows 'System Control Panel' dialog (search at the toolbar for 'Edit environment variables for your account') to prefix the relevant path (the one yielded by cabal path --installdir) to the start of the PATH; alternatively
  • On PowerShell only, add the following to your PowerShell profile file:
    $Env:PATH = "$(cabal -v0 path --installdir)" + ";" + $Env:PATH

To keep things simple, I'm leaning towards only covering how to set it temporary in cmd.exe and then leave it to the user to figure out how to make it permanent.

Or is it safe to assume that everybody is using PowerShell instead of cmd.exe by now? My rational for defaulting cmd.exe is that a PowerShell user can probably adapt the cmd.exe instructions, while the reverse may not be necessarily true.

How common is bash on Windows, btw? (e.g. when you install git on Windows, does this include some "Git prompt"; and if yes, does it use bash or cmd.exe)

Do you need to warn your README.md readers that cabal path requires Cabal (the tool) version 3.12.1.0 or greater.

Good point. https://github.com/sol/doctest/pull/436

mpilgrem commented 4 months ago

Windows Terminal is the native terminal software on Windows 11 and freely available for Windows 10. My assumption is that most Haskellers on Windows will be using Windows Terminal. By default, PowerShell is the default shell in Windows Terminal but Command Prompt is only one click away and Windows Terminal is easy to configure; so the choice of Command Prompt versus PowerShell is, ultimately, one of user preference. For my own part, I rarely use Command Prompt now.

Git for Windows does come with 'Git Bash' (which I understand to be a Git-supplied MSYS2), but I never have cause to use Git Bash myself. If I want to use Unix-origin tools, I make use of the Stack-supplied MSYS2 and stick with that.

sol commented 4 months ago

@mpilgrem thanks for elaborating. Let's just go with PowerShell then.