File tree 7 files changed +38
-4
lines changed
7 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ parseSnackConfig = SnackConfig <$> Opts.optional
234
234
data Command
235
235
= Build
236
236
| Run [String ] -- Run with extra args
237
- | Ghci
237
+ | Ghci [ String ]
238
238
| Test
239
239
| Hoogle
240
240
@@ -245,7 +245,9 @@ parseCommand =
245
245
<> Opts. command " run" (Opts. info
246
246
( Run <$> Opts. many (Opts. argument Opts. str (Opts. metavar " ARG" ))
247
247
) mempty )
248
- <> Opts. command " ghci" (Opts. info (pure Ghci ) mempty )
248
+ <> Opts. command " ghci" (Opts. info
249
+ ( Ghci <$> Opts. many (Opts. argument Opts. str (Opts. metavar " ARG" ))
250
+ ) mempty )
249
251
<> Opts. command " hoogle" (Opts. info (pure Hoogle ) mempty )
250
252
)
251
253
<|> Opts. hsubparser
@@ -460,7 +462,7 @@ runCommand :: SnackConfig -> PackageFile -> Command -> IO ()
460
462
runCommand snackCfg packageFile = \ case
461
463
Build -> S. shelly $ void $ snackBuild snackCfg packageFile
462
464
Run args -> quiet (snackBuild snackCfg packageFile) >>= runBuildResult args
463
- Ghci -> flip runExe [] =<<
465
+ Ghci args -> flip runExe args =<<
464
466
ghciExePath <$> (quiet (snackGhci snackCfg packageFile))
465
467
Test -> noTest
466
468
Hoogle -> flip runExe [ " server" , " --local" ] =<<
Original file line number Diff line number Diff line change 48
48
done
49
49
fi
50
50
done
51
- ${ ghc } /bin/ghci ${ lib . strings . escapeShellArgs ghciArgs }
51
+ ${ ghc } /bin/ghci ${ lib . strings . escapeShellArgs ghciArgs } $@
52
52
'' ;
53
53
}
Original file line number Diff line number Diff line change
1
+ module Main where
2
+
3
+ import Data.Text
4
+
5
+ main = putStrLn $ unpack " hello"
Original file line number Diff line number Diff line change
1
+ hello
Original file line number Diff line number Diff line change
1
+ { main = "Main" ;
2
+ src = ./. ;
3
+ dependencies = [ "text" ] ;
4
+ }
Original file line number Diff line number Diff line change
1
+ name : snack-extensions-test
2
+ dependencies :
3
+ - text
4
+ executable :
5
+ main : Main.hs
6
+ source-dirs : .
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # vim: ft=sh sw=2 et
3
+
4
+ set -euo pipefail
5
+
6
+ test () {
7
+ TMP_FILE=$( mktemp)
8
+
9
+ capture_io " $TMP_FILE " main | $SNACK ghci -- -XOverloadedStrings
10
+
11
+ diff golden $TMP_FILE
12
+ rm $TMP_FILE
13
+ }
14
+
15
+ SNACK=" snack --package-file ./package.nix" test
16
+ SNACK=" snack --package-file ./package.yaml" test
You can’t perform that action at this time.
0 commit comments