GithubHelp home page GithubHelp logo

kakkun61 / ghcman Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 3.0 123 KB

Switch GHC and Cabal quickly on PowerShell

Home Page: https://www.powershellgallery.com/packages/ghcman/

License: Other

PowerShell 99.23% Dockerfile 0.77%
powershell haskell ghc cabal windows hacktoberfest

ghcman's People

Contributors

gitter-badger avatar kakkun61 avatar spamviech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ghcman's Issues

Suport of PowerShell Desktop edition may be removed

I'm implementing tab key completion for ghcups. I am planning to remove support for PowerShell Desktop edition for simplicity of implementation of the completion.

If you use PowerShell Desktop edition and you cannot move to use PowerShell Core edition, please tell me the reason of it.

The reason and its quantity may make ghcups keep to support Desktop edition.

Cannot install using install-module

When I try to install this, I get the following:

PS C:\WINDOWS\system32> install-module -Name ghcups

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you
want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
PackageManagement\Install-Package : The module 'ghcups' cannot be installed or updated because it is not a properly-formed module.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : InvalidManifestModule,Test-ValidManifestModule,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Install msys2?

For windows users, msys2 is needed when compiling packages like network. For this reason stack installs msys2 along ghc by extracting a tarball. Maybe it's a useful thing to do here too; there's also msys2 on chocolatey so that can be used if convenient.

The global configuration is not read when the local configuration exists

The expected algorithm

When Set-Ghc foo,

  1. get ghc.foo in the local configuration
  2. when the step 1 fails, get ghc.foo in the global configuration

The implemented algorithm

  1. when the local configuration exists,
    1. get ghc.foo in the local configuration
    2. when not found, fails in the result
  2. when the global configuration else exists,
    1. get ghc.foo in the global configuration

Install Chocolatey

When choco is not found, attempt to install Chocolatey.

  1. choco does not exist in $Env:Path
  2. Ask to the user
  3. Check whether the current shell is the administrative PowerShell
  4. Tell to update $Env:Path of the current shell or to restart the shell

Install-Cabal appears to fail

Attempting to install cabal with something like Install-Cabal 3.2.0.0 appears to fail.

This appears to be due to a call to an undefined function Expand-Archive in ghcups.psm1 (line 502).

Show-Ghc only shows old ghc versions

Using Show-Ghc only displays old ghc-versions, even though a newer on (8.10.1) is already installed using chocolatey:

PS C:\WINDOWS\system32> Show-Ghc                                                                                        Chocolatey v0.10.15
ghc 8.0.1 [Approved] Downloads cached for licensed users
ghc 7.6.1.1 [Approved]
ghc 7.6.2.1 [Approved]
ghc 7.6.3.1 [Approved]
ghc 7.8.2.1 [Approved]
ghc 7.8.1.1 [Approved]
6 packages found.

Using choco search returns the current version

PS C:\WINDOWS\system32> choco search ghc                                                                                Chocolatey v0.10.15
ghc 8.10.1 [Approved]
haskell-dev 0.0.1 [Approved]
cabal 3.2.0.0 [Approved] Downloads cached for licensed users
haskell-stack 2.3.1 [Approved] Downloads cached for licensed users
idris 1.1.1 [Approved] Downloads cached for licensed users - Possibly broken for FOSS users (due to original download location changes by vendor)
5 packages found.

Running in an admin-PS session with german region and Beta-UTF8-support enabled.
Current Codepage is 65001 (UTF-8).

Update-GhcmanVersionFile : 404 Not Found

Describe the bug

When invoking Update-GhcmanVersionFile the following error is raised:

PS C:\> Update-GhcmanVersionFile
Invoke-WebRequest: 404: Not Found

I don't know much about PS but i think the [Version] "attribute" when setting the $ghcmanVersion is at fault here:

PS C:\> Set-Variable ghcmanVersion -Option Constant -Value [Version]"4.8"
PS C:\> $ghcmanVersion
[Version]4.8
PS C:\> Write-Output "https://raw.githubusercontent.com/kakkun61/ghcman/master/version.$ghcmanVersion.yaml"
https://raw.githubusercontent.com/kakkun61/ghcman/master/version.[Version]4.8.yaml
PS C:\> Invoke-WebRequest "https://raw.githubusercontent.com/kakkun61/ghcman/master/version.$ghcmanVersion.yaml"
Invoke-WebRequest: 404: Not Found

PS C:\>  Set-Variable ghcmanVersion -Option Constant -Value "4.8"
PS C:\> $ghcmanVersion
4.8
PS C:\> Invoke-WebRequest "https://raw.githubusercontent.com/kakkun61/ghcman/master/version.$ghcmanVersion.yaml"

StatusCode        : 200
StatusDescription : OK
Content           : ...

To Reproduce

Steps to reproduce the behavior:

Following the Readme:

  1. Run Cmdlet Import-Module ghcman
  2. Run Cmdlet Get-Module ghcman
  3. Run Cmdlet Update-GhcmanVersionFile
  4. See error 'Invoke-WebRequest: 404: Not Found`

Expected behavior

The cmdlet invocation to succeed and the versionfile to be updated.

Environment

  • OS: [e.g. Windows 10 19044]
  • PowerShell:
Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
  • Version: 4.8

User global configuration

Now there are two configuration:

  • the local configuration ($PWD)
  • the system global configuration ($Env:ProgramData\ghcups like C:\ProgramData\ghcups)

Add:

  • the user global configuration ($Env:APPDATA\ghcups like C:\Users\kazukiokamoto\AppData\Roaming\ghcups)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.