inim-repl / INim

Interactive Nim shell / REPL / Playground
MIT License
644 stars 23 forks source link

Fix for flags with no -d prefix #104

Closed Tangdongle closed 4 years ago

Tangdongle commented 4 years ago

Fix for https://github.com/inim-repl/INim/issues/103 (Thanks iambudi)

Fix for not stripping when checking for echoes from piped data

0atman commented 4 years ago

I can confirm master is broken:

INim on  master [?] via 👑 v1.2.6 

λ nimble build
  Verifying dependencies for inim@0.5.0
      Info: Dependency on cligen@>= 1.0.0 already satisfied
  Verifying dependencies for cligen@1.0.0
      Info: Dependency on noise@any version already satisfied
  Verifying dependencies for noise@0.1.3
   Building inim/inim using c backend
INim on  master [?] via 👑 v1.2.6 took 2s 

λ ./inim --flags=threads:on
👑 INim 0.5.0
Nim Compiler Version 1.2.6 [Linux: amd64] at /home/oatman/.nimble/bin/nim
nim> import threadpool
/home/oatman/.choosenim/toolchains/nim-1.2.6/lib/pure/concurrency/threadpool.nim(21, 10) Error: Threadpool requires --threads:on option.
nim> 

Quitting INim: Goodbye!
INim on  master [?] via 👑 v1.2.6 took 7s

But unless I'm mistaken, this branch doesn't fix it?

λ git checkout -b TangersTongle-flag_fix master
Switched to a new branch 'TangersTongle-flag_fix'
INim on  TangersTongle-flag_fix [?] via 👑 v1.2.6 

λ git pull https://github.com/TangersTongle/INim.git flag_fix
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 10 (delta 6), reused 10 (delta 6), pack-reused 0
Unpacking objects: 100% (10/10), 1.09 KiB | 558.00 KiB/s, done.
From https://github.com/TangersTongle/INim
 * branch            flag_fix   -> FETCH_HEAD
Updating 9c3ed8b..4efb017
Fast-forward
 src/inim.nim   | 13 ++++++++++---
 tests/test.nim |  3 +++
 2 files changed, 13 insertions(+), 3 deletions(-)
INim on  TangersTongle-flag_fix [?] via 👑 v1.2.6 

λ nimble build
  Verifying dependencies for inim@0.5.0
      Info: Dependency on cligen@>= 1.0.0 already satisfied
  Verifying dependencies for cligen@1.0.0
      Info: Dependency on noise@any version already satisfied
  Verifying dependencies for noise@0.1.3
   Building inim/inim using c backend
INim on  TangersTongle-flag_fix [?] via 👑 v1.2.6 

λ ./inim --flags=threads:on
👑 INim 0.5.0
Nim Compiler Version 1.2.6 [Linux: amd64] at /home/oatman/.nimble/bin/nim
nim> import threadpool
/home/oatman/.choosenim/toolchains/nim-1.2.6/lib/pure/concurrency/threadpool.nim(21, 10) Error: Threadpool requires --threads:on option.
nim> 
0atman commented 4 years ago

Tests pass though ¯\(ツ)

0atman commented 4 years ago

Thanks very much for this @Tangdongle, have I built it wrongly?

Tangdongle commented 4 years ago

Hey @0atman , I updated the README to reflect what is available. With your example, you needed the -- prefix before --thread:on

0atman commented 4 years ago

I don't follow

λ ./inim -- --flags=threads:on
main does not expect non-option arguments at "--flags=threads:on".
Run with --help for full usage.
Tangdongle commented 4 years ago

Try ./inim --flags=--threads:on or ./inim -d=--threads:on

0atman commented 4 years ago

Sorry for my misunderstanding! This is fantastic, thanks very much!

λ ./inim --flags=--threads:on
👑 INim 0.5.0
Nim Compiler Version 1.2.6 [Linux: amd64] at /home/oatman/.nimble/bin/nim
nim> import threadpool
nim>   # OK!