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

choosenim self tries to download Nim with choosenim version #322

Open
dlesnoff opened this issue Mar 11, 2023 · 1 comment
Open

choosenim self tries to download Nim with choosenim version #322

dlesnoff opened this issue Mar 11, 2023 · 1 comment

Comments

@dlesnoff
Copy link

dlesnoff commented Mar 11, 2023

I tried to run (by mistake)

choosenim self

which gave:

Downloading Nim 0.8.4 from nim-lang.org

      Info: Binary build unavailable, building from source

       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: /__w/choosenim/choosenim/src/choosenim.nim(350) choosenim
        ... /__w/choosenim/choosenim/src/choosenim.nim(340) performAction
        ... /__w/choosenim/choosenim/src/choosenim.nim(124) choose
        ... /__w/choosenim/choosenim/src/choosenim.nim(111) chooseVersion
        ... /__w/choosenim/choosenim/src/choosenim.nim(24) installVersion
        ... /__w/choosenim/choosenim/src/choosenimpkg/download.nim(316) download
        ... Version 0.8.4 does not exist.

It tried to download the Nim 0.8.4 version with my choosenim version: 0.8.4
This is not a problem since this Nim version does not exist, but it could become problematic if choosenim version matches an existing Nim version.

Expected output

Either an error or self becomes an alias of update self

@dlesnoff dlesnoff changed the title choosenim self tries to download a nim version with choosenim version choosenim self tries to download Nim with choosenim version Mar 11, 2023
@SpotlightKid
Copy link

Seems to be an easy fix:

(added self to command check and ordered of clauses alphabetically)

diff --git a/src/choosenim.nim b/src/choosenim.nim
index 7493878..fba9c81 100644
--- a/src/choosenim.nim
+++ b/src/choosenim.nim
@@ -328,14 +328,16 @@ proc performAction(params: CliParams) =
   report(initEvent(ActionEvent), params)
 
   case params.command.normalize
-  of "update":
-    update(params)
+  of "remove":
+    remove(params)
+  of "self":
+    updateSelf(params)
   of "show":
     show(params)
+  of "update":
+    update(params)
   of "versions":
     versions(params)
-  of "remove":
-    remove(params)
   else:
     choose(params)

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

No branches or pull requests

2 participants