@@ -17,7 +17,8 @@ import Control.Monad.Extra ( concatMapM
17
17
, when
18
18
)
19
19
import Data.Hashable ( hash )
20
- import Data.List ( isSuffixOf
20
+ import Data.List ( intercalate
21
+ , isSuffixOf
21
22
, find
22
23
, nub
23
24
)
@@ -35,6 +36,7 @@ import Development.Shake.FilePath ( (</>)
35
36
import Options.Applicative ( Parser
36
37
, (<**>)
37
38
, (<|>)
39
+ , auto
38
40
, command
39
41
, execParser
40
42
, fullDesc
@@ -45,6 +47,7 @@ import Options.Applicative ( Parser
45
47
, long
46
48
, many
47
49
, metavar
50
+ , option
48
51
, optional
49
52
, progDesc
50
53
, short
@@ -89,14 +92,14 @@ data Arguments =
89
92
, runCompiler :: FilePath
90
93
, runFlags :: [String ]
91
94
, runTarget :: Maybe String
92
- , runArgs :: Maybe String
95
+ , runArgs :: Maybe [ String ]
93
96
}
94
97
| Test
95
98
{ testRelease :: Bool
96
99
, testCompiler :: FilePath
97
100
, testFlags :: [String ]
98
101
, testTarget :: Maybe String
99
- , testArgs :: Maybe String
102
+ , testArgs :: Maybe [ String ]
100
103
}
101
104
102
105
data TomlSettings = TomlSettings {
@@ -182,7 +185,7 @@ app args settings = case args of
182
185
(map
183
186
(++ case runArgs of
184
187
Nothing -> " "
185
- Just theArgs -> " " ++ theArgs
188
+ Just theArgs -> " " ++ (intercalate " " theArgs)
186
189
)
187
190
canonicalExecutables
188
191
)
@@ -200,8 +203,9 @@ app args settings = case args of
200
203
Nothing -> putStrLn " Executable Not Found"
201
204
Just specified -> do
202
205
exitCode <- case runArgs of
203
- Nothing -> system specified
204
- Just theArgs -> system (specified ++ " " ++ theArgs)
206
+ Nothing -> system specified
207
+ Just theArgs ->
208
+ system (specified ++ " " ++ (intercalate " " theArgs))
205
209
exitWith exitCode
206
210
Test { testTarget = whichOne, testArgs = testArgs } -> do
207
211
build settings
@@ -224,7 +228,7 @@ app args settings = case args of
224
228
(map
225
229
(++ case testArgs of
226
230
Nothing -> " "
227
- Just theArgs -> " " ++ theArgs
231
+ Just theArgs -> " " ++ (intercalate " " theArgs)
228
232
)
229
233
canonicalExecutables
230
234
)
@@ -242,8 +246,9 @@ app args settings = case args of
242
246
Nothing -> putStrLn " Test Not Found"
243
247
Just specified -> do
244
248
exitCode <- case testArgs of
245
- Nothing -> system specified
246
- Just theArgs -> system (specified ++ " " ++ theArgs)
249
+ Nothing -> system specified
250
+ Just theArgs ->
251
+ system (specified ++ " " ++ (intercalate " " theArgs))
247
252
exitWith exitCode
248
253
_ -> putStrLn " Shouldn't be able to get here"
249
254
@@ -420,11 +425,17 @@ runArguments =
420
425
)
421
426
)
422
427
<*> optional
423
- (strArgument
424
- (metavar " TARGET" <> help " Name of the executable to run" )
428
+ (strOption
429
+ (long " target" <> metavar " TARGET" <> help
430
+ " Name of the executable to run"
431
+ )
425
432
)
426
433
<*> optional
427
- (strArgument (metavar " ARGS" <> help " Arguments to the executable" ))
434
+ (many
435
+ (strArgument
436
+ (metavar " ARGS" <> help " Arguments to the executable(s) (should follow '--')" )
437
+ )
438
+ )
428
439
429
440
testArguments :: Parser Arguments
430
441
testArguments =
@@ -449,8 +460,13 @@ testArguments =
449
460
)
450
461
)
451
462
<*> optional
452
- (strArgument (metavar " TARGET" <> help " Name of the test to run" ))
453
- <*> optional (strArgument (metavar " ARGS" <> help " Arguments to the test" ))
463
+ (strOption (long " target" <> metavar " TARGET" <> help " Name of the test to run" ))
464
+ <*> optional
465
+ (many
466
+ (strArgument
467
+ (metavar " ARGS" <> help " Arguments to the test(s) (should follow '--')" )
468
+ )
469
+ )
454
470
455
471
getDirectoriesFiles :: [FilePath ] -> [FilePattern ] -> IO [FilePath ]
456
472
getDirectoriesFiles dirs exts = getDirectoryFilesIO " " newPatterns
0 commit comments