Skip to content

Commit

Permalink
Merge pull request #658 from sorki/fix/repline_0_4
Browse files Browse the repository at this point in the history
Epic Support repline 0.4
  • Loading branch information
Anton-Latukha authored Jul 8, 2020
2 parents b4e3b3b + c9eb246 commit 3fb78fc
Show file tree
Hide file tree
Showing 5 changed files with 461 additions and 117 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ctags
dist-newstyle
result*
.ghc.environment.*
.hnixrc
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ $ env NIXPKGS_TESTS=yes PRETTY_TESTS=1 cabal v2-test
$ ./dist/build/hnix/hnix --help
```

## Using the REPL

To enter the `hnix` REPL use

```
hnix --repl
```

To evaluate an expression and make it available in the REPL
as the `input` variable use

```
hnix --eval -E '(import <nixpkgs> {}).pkgs.hello' --repl
```

Use the `:help` command for a list of all available REPL commands.

## Building with full debug info

To build `hnix` for debugging, and with full tracing output and stack traces,
Expand Down
2 changes: 1 addition & 1 deletion hnix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ executable hnix
, pretty-show
, prettyprinter
, ref-tf
, repline
, repline >= 0.4.0.0 && < 0.5
, serialise
, template-haskell
, text
Expand Down
7 changes: 6 additions & 1 deletion main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ main = do
@(StdThunk (StandardT (StdIdT IO)))
frames

when (repl opts) $ withNixContext Nothing Repl.main
when (repl opts) $
if evaluate opts
then do
val <- Nix.nixEvalExprLoc mpath expr
withNixContext Nothing (Repl.main' $ Just val)
else withNixContext Nothing Repl.main

process opts mpath expr
| evaluate opts
Expand Down
Loading

0 comments on commit 3fb78fc

Please sign in to comment.